Merge branch 'knn' of https://bitbucket.org/ausocean/av into knn

This commit is contained in:
Ella Pietraroia 2019-12-31 15:36:17 +10:30
commit 5d6899e346
1 changed files with 10 additions and 0 deletions

View File

@ -1,6 +1,9 @@
/*
<<<<<<< HEAD
// +build !circleci
=======
>>>>>>> 65f1c89ff2220eb828dcec312da11dbc620449bc
DESCRIPTION
A filter that detects motion and discards frames without motion. The
filter uses a K-Nearest Neighbours (KNN) to determine what is
@ -29,7 +32,10 @@ LICENSE
package filter
import (
<<<<<<< HEAD
"fmt"
=======
>>>>>>> 65f1c89ff2220eb828dcec312da11dbc620449bc
"image"
"image/color"
"io"
@ -75,10 +81,14 @@ func (m *KNNFilter) Close() error {
// Write applies the motion filter to the video stream. Only frames with motion
// are written to the destination encoder, frames without are discarded.
func (m *KNNFilter) Write(f []byte) (int, error) {
<<<<<<< HEAD
img, err := gocv.IMDecode(f, gocv.IMReadColor)
if err != nil {
return 0, fmt.Errorf("can't decode image: %w", err)
}
=======
img, _ := gocv.IMDecode(f, gocv.IMReadColor)
>>>>>>> 65f1c89ff2220eb828dcec312da11dbc620449bc
defer img.Close()
imgDelta := gocv.NewMat()