filter/mog.go: Write returns 0 instead of -1

This commit is contained in:
Scott 2020-01-02 13:32:05 +10:30
parent 29443bd61f
commit 3e19fb7cd6
1 changed files with 2 additions and 2 deletions

View File

@ -77,7 +77,7 @@ func (m *MOGFilter) Close() error {
func (m *MOGFilter) Write(f []byte) (int, error) {
img, err := gocv.IMDecode(f, gocv.IMReadColor)
if err != nil {
return -1, fmt.Errorf("image can't be decoded: %w", err)
return 0, fmt.Errorf("image can't be decoded: %w", err)
}
defer img.Close()
@ -125,7 +125,7 @@ func (m *MOGFilter) Write(f []byte) (int, error) {
// Don't write to destination if there is no motion.
if len(contours) == 0 {
return -1, nil
return 0, nil
}
// Write to destination.