Frame counter resets on a consistent interval.

This commit is contained in:
Scott 2020-01-08 11:31:09 +10:30
parent 0b95041d4f
commit 4b28558924
1 changed files with 66 additions and 65 deletions

View File

@ -84,7 +84,9 @@ func (m *MOGFilter) Write(f []byte) (int, error) {
m.hold[hfCount] = f m.hold[hfCount] = f
hfCount++ hfCount++
return 0, nil return 0, nil
} else { }
hfCount = 0
img, err := gocv.IMDecode(f, gocv.IMReadColor) img, err := gocv.IMDecode(f, gocv.IMReadColor)
if err != nil { if err != nil {
return 0, fmt.Errorf("image can't be decoded: %w", err) return 0, fmt.Errorf("image can't be decoded: %w", err)
@ -147,7 +149,6 @@ func (m *MOGFilter) Write(f []byte) (int, error) {
} }
} }
hfCount = 0
return m.dst.Write(f) return m.dst.Write(f)
}
} }