mirror of https://bitbucket.org/ausocean/av.git
add go routine to write function
This commit is contained in:
parent
07c2472bdd
commit
b0f756a586
|
@ -195,15 +195,17 @@ func (tp *turbidityProbe) Write(p []byte) (int, error) {
|
||||||
tp.log.Log(logger.Debug, "found frames", "frames", len(imgs))
|
tp.log.Log(logger.Debug, "found frames", "frames", len(imgs))
|
||||||
|
|
||||||
// Process video data to get saturation and contrast scores.
|
// Process video data to get saturation and contrast scores.
|
||||||
startTime := time.Now()
|
go func() {
|
||||||
res, err := tp.ts.Evaluate(imgs)
|
startTime := time.Now()
|
||||||
tp.log.Log(logger.Debug, "finished evaluation", "total duration (sec)", time.Since(startTime).Seconds())
|
res, err := tp.ts.Evaluate(imgs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
tp.log.Error("evaluate failed", "error", err.Error())
|
tp.log.Error("evaluate failed", "error", err.Error())
|
||||||
return len(p), err
|
} else {
|
||||||
}
|
tp.log.Log(logger.Debug, "finished evaluation", "total duration (sec)", time.Since(startTime).Seconds())
|
||||||
tp.contrast = stat.Mean(res.Contrast, nil)
|
tp.contrast = stat.Mean(res.Contrast, nil)
|
||||||
tp.sharpness = stat.Mean(res.Sharpness, nil)
|
tp.sharpness = stat.Mean(res.Sharpness, nil)
|
||||||
|
}
|
||||||
|
}()
|
||||||
default:
|
default:
|
||||||
return len(p), nil
|
return len(p), nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue