mirror of https://bitbucket.org/ausocean/av.git
filter: return length from the filter's Write method
This commit is contained in:
parent
fb43e9214a
commit
a111f21427
|
@ -76,8 +76,11 @@ func (d *Difference) Write(f []byte) (int, error) {
|
|||
if d.prev.Empty() {
|
||||
var err error
|
||||
d.prev, err = gocv.IMDecode(f, gocv.IMReadColor)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return len(f), nil
|
||||
}
|
||||
|
||||
img, err := gocv.IMDecode(f, gocv.IMReadColor)
|
||||
defer img.Close()
|
||||
|
@ -94,7 +97,7 @@ func (d *Difference) Write(f []byte) (int, error) {
|
|||
|
||||
mean := imgDelta.Mean().Val1
|
||||
|
||||
// Update History
|
||||
// Update History.
|
||||
d.prev = img.Clone()
|
||||
|
||||
// Draw debug information.
|
||||
|
@ -118,7 +121,7 @@ func (d *Difference) Write(f []byte) (int, error) {
|
|||
|
||||
// Don't write to destination if there is no motion.
|
||||
if mean < d.thresh {
|
||||
return 0, nil
|
||||
return len(f), nil
|
||||
}
|
||||
|
||||
// Write to destination.
|
||||
|
|
Loading…
Reference in New Issue