From a02a60b00883a45805a6cdd783028801a9bdcb4f Mon Sep 17 00:00:00 2001 From: Ella Pietraroia Date: Mon, 23 Dec 2019 14:58:35 +1030 Subject: [PATCH 01/15] making new knn file, plus adding knn option into variables --- revid/config/config.go | 1 + revid/revid.go | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/revid/config/config.go b/revid/config/config.go index 00c4dda0..d13157b2 100644 --- a/revid/config/config.go +++ b/revid/config/config.go @@ -113,6 +113,7 @@ const ( FilterNoOp = iota FilterMOG FilterVariableFPS + FilterKNN ) // Config provides parameters relevant to a revid instance. A new config must diff --git a/revid/revid.go b/revid/revid.go index d2558057..33e3b498 100644 --- a/revid/revid.go +++ b/revid/revid.go @@ -335,6 +335,8 @@ func (r *Revid) setupPipeline(mtsEnc func(dst io.WriteCloser, rate float64) (io. r.filter = filter.NewMOGFilter(r.encoders, 25, 20, 500, 3, true) case config.FilterVariableFPS: r.filter = filter.NewVariableFPSFilter(r.encoders, 1.0, filter.NewMOGFilter(r.encoders, 25, 20, 500, 3, true)) + case config.FilterKNN: + r.filter = filter.NewKNNFilter(r.encoders, 25, 20, 500, 3, true) default: panic("Undefined Filter") } @@ -647,7 +649,7 @@ func (r *Revid) Update(vars map[string]string) error { r.cfg.Logger.Log(logger.Warning, pkg+"invalid VerticalFlip param", "value", value) } case "Filter": - m := map[string]int{"NoOp": config.FilterNoOp, "MOG": config.FilterMOG, "VariableFPS": config.FilterVariableFPS} + m := map[string]int{"NoOp": config.FilterNoOp, "MOG": config.FilterMOG, "VariableFPS": config.FilterVariableFPS, "KNN": config.FilterKNN} v, ok := m[value] if !ok { r.cfg.Logger.Log(logger.Warning, pkg+"invalid FilterMethod param", "value", value) From 8f3faeb197085ec57911b786b82d701b2eab9ce1 Mon Sep 17 00:00:00 2001 From: Ella Pietraroia Date: Mon, 23 Dec 2019 14:59:48 +1030 Subject: [PATCH 02/15] adding knn.go file --- filter/knn.go | 127 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 filter/knn.go diff --git a/filter/knn.go b/filter/knn.go new file mode 100644 index 00000000..efa43862 --- /dev/null +++ b/filter/knn.go @@ -0,0 +1,127 @@ +/* +DESCRIPTION + A filter that detects motion and discards frames without motion. The + filter uses a Mixture of Gaussians method (KNN) to determine what is + background and what is foreground. + +AUTHORS + Scott Barnard + +LICENSE + KNN.go is Copyright (C) 2019 the Australian Ocean Lab (AusOcean) + + It is free software: you can redistribute it and/or modify them + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + It is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + in gpl.txt. If not, see http://www.gnu.org/licenses. +*/ + +package filter + +import ( + "image" + "image/color" + "io" + + "gocv.io/x/gocv" +) + +// KNNFilter is a filter that provides basic motion detection. KNN is short for +// Mixture of Gaussians method. +type KNNFilter struct { + dst io.WriteCloser + area float64 + bs *gocv.BackgroundSubtractorKNN + knl gocv.Mat + debug bool + windows []*gocv.Window +} + +// NewKNNFilter returns a pointer to a new KNNFilter. +func NewKNNFilter(dst io.WriteCloser, area, threshold float64, history, kernelSize int, debug bool) *KNNFilter { + bs := gocv.NewBackgroundSubtractorKNNWithParams(history, threshold, false) + k := gocv.GetStructuringElement(gocv.MorphRect, image.Pt(kernelSize, kernelSize)) + var windows []*gocv.Window + if debug { + windows = []*gocv.Window{gocv.NewWindow("Debug: Bounding boxes"), gocv.NewWindow("Debug: Motion")} + } + return &KNNFilter{dst, area, &bs, k, debug, windows} +} + +// Implements io.Closer. +// Close frees resources used by gocv, because it has to be done manually, due to +// it using c-go. +func (m *KNNFilter) Close() error { + m.bs.Close() + m.knl.Close() + for _, window := range m.windows { + window.Close() + } + return nil +} + +// Implements io.Writer. +// 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) { + img, _ := gocv.IMDecode(f, gocv.IMReadColor) + defer img.Close() + + imgDelta := gocv.NewMat() + defer imgDelta.Close() + + // Seperate foreground and background. + m.bs.Apply(img, &imgDelta) + + // Threshold imgDelta. + gocv.Threshold(imgDelta, &imgDelta, 25, 255, gocv.ThresholdBinary) + + // Remove noise. + gocv.Erode(imgDelta, &imgDelta, m.knl) + gocv.Dilate(imgDelta, &imgDelta, m.knl) + + // Fill small holes. + gocv.Dilate(imgDelta, &imgDelta, m.knl) + gocv.Erode(imgDelta, &imgDelta, m.knl) + + // Find contours and reject ones with a small area. + var contours [][]image.Point + allContours := gocv.FindContours(imgDelta, gocv.RetrievalExternal, gocv.ChainApproxSimple) + for _, c := range allContours { + if gocv.ContourArea(c) > m.area { + contours = append(contours, c) + } + } + + // Draw debug information. + if m.debug { + for _, c := range contours { + rect := gocv.BoundingRect(c) + gocv.Rectangle(&img, rect, color.RGBA{0, 0, 255, 0}, 1) + } + + if len(contours) > 0 { + gocv.PutText(&img, "Motion", image.Pt(32, 32), gocv.FontHersheyPlain, 2.0, color.RGBA{255, 0, 0, 0}, 2) + } + + m.windows[0].IMShow(img) + m.windows[1].IMShow(imgDelta) + m.windows[0].WaitKey(1) + } + + // Don't write to destination if there is no motion. + if len(contours) == 0 { + return -1, nil + } + + // Write to destination. + return m.dst.Write(f) +} From 3e238bb676293f409c9ccfeb5f2dc8eee36a961f Mon Sep 17 00:00:00 2001 From: Ella Pietraroia Date: Tue, 31 Dec 2019 13:26:36 +1030 Subject: [PATCH 03/15] chaning parameters of filter --- revid/revid.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/revid/revid.go b/revid/revid.go index 33e3b498..5f4df7d8 100644 --- a/revid/revid.go +++ b/revid/revid.go @@ -336,7 +336,7 @@ func (r *Revid) setupPipeline(mtsEnc func(dst io.WriteCloser, rate float64) (io. case config.FilterVariableFPS: r.filter = filter.NewVariableFPSFilter(r.encoders, 1.0, filter.NewMOGFilter(r.encoders, 25, 20, 500, 3, true)) case config.FilterKNN: - r.filter = filter.NewKNNFilter(r.encoders, 25, 20, 500, 3, true) + r.filter = filter.NewKNNFilter(r.encoders, 25, 300, 300, 9, true) default: panic("Undefined Filter") } From 51e45c6ffa5378b916d37e745008b3f22f1641e6 Mon Sep 17 00:00:00 2001 From: Ella Pietraroia Date: Tue, 31 Dec 2019 13:37:47 +1030 Subject: [PATCH 04/15] Documentation comments --- filter/knn.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/filter/knn.go b/filter/knn.go index efa43862..3e494253 100644 --- a/filter/knn.go +++ b/filter/knn.go @@ -1,11 +1,11 @@ /* DESCRIPTION A filter that detects motion and discards frames without motion. The - filter uses a Mixture of Gaussians method (KNN) to determine what is + filter uses a K-Nearest Neighbours (KNN) to determine what is background and what is foreground. AUTHORS - Scott Barnard + Ella Pietraroia LICENSE KNN.go is Copyright (C) 2019 the Australian Ocean Lab (AusOcean) @@ -35,7 +35,7 @@ import ( ) // KNNFilter is a filter that provides basic motion detection. KNN is short for -// Mixture of Gaussians method. +// K-Nearest Neighbours method. type KNNFilter struct { dst io.WriteCloser area float64 From 65f1c89ff2220eb828dcec312da11dbc620449bc Mon Sep 17 00:00:00 2001 From: Ella Pietraroia Date: Tue, 31 Dec 2019 15:18:06 +1030 Subject: [PATCH 05/15] adding constants for the integer arguments --- revid/revid.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/revid/revid.go b/revid/revid.go index 5f4df7d8..fd3f83cf 100644 --- a/revid/revid.go +++ b/revid/revid.go @@ -76,6 +76,15 @@ const ( rtmpConnectionTimeout = 10 ) +// KNN filter properties +const ( + knnMinArea = 25.0 + knnThreshold = 300 + knnHistory = 300 + knnKernel = 9 + knnShowWindows = true +) + const pkg = "revid: " type Logger interface { @@ -336,7 +345,7 @@ func (r *Revid) setupPipeline(mtsEnc func(dst io.WriteCloser, rate float64) (io. case config.FilterVariableFPS: r.filter = filter.NewVariableFPSFilter(r.encoders, 1.0, filter.NewMOGFilter(r.encoders, 25, 20, 500, 3, true)) case config.FilterKNN: - r.filter = filter.NewKNNFilter(r.encoders, 25, 300, 300, 9, true) + r.filter = filter.NewKNNFilter(r.encoders, knnMinArea, knnThreshold, knnHistory, knnKernel, knnShowWindows) default: panic("Undefined Filter") } From d44e795ea26cfcf26d351165f48afc8db781a6c1 Mon Sep 17 00:00:00 2001 From: Ella Pietraroia Date: Mon, 23 Dec 2019 14:58:35 +1030 Subject: [PATCH 06/15] making new knn file, plus adding knn option into variables --- revid/config/config.go | 1 + revid/revid.go | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/revid/config/config.go b/revid/config/config.go index 00c4dda0..d13157b2 100644 --- a/revid/config/config.go +++ b/revid/config/config.go @@ -113,6 +113,7 @@ const ( FilterNoOp = iota FilterMOG FilterVariableFPS + FilterKNN ) // Config provides parameters relevant to a revid instance. A new config must diff --git a/revid/revid.go b/revid/revid.go index d2558057..33e3b498 100644 --- a/revid/revid.go +++ b/revid/revid.go @@ -335,6 +335,8 @@ func (r *Revid) setupPipeline(mtsEnc func(dst io.WriteCloser, rate float64) (io. r.filter = filter.NewMOGFilter(r.encoders, 25, 20, 500, 3, true) case config.FilterVariableFPS: r.filter = filter.NewVariableFPSFilter(r.encoders, 1.0, filter.NewMOGFilter(r.encoders, 25, 20, 500, 3, true)) + case config.FilterKNN: + r.filter = filter.NewKNNFilter(r.encoders, 25, 20, 500, 3, true) default: panic("Undefined Filter") } @@ -647,7 +649,7 @@ func (r *Revid) Update(vars map[string]string) error { r.cfg.Logger.Log(logger.Warning, pkg+"invalid VerticalFlip param", "value", value) } case "Filter": - m := map[string]int{"NoOp": config.FilterNoOp, "MOG": config.FilterMOG, "VariableFPS": config.FilterVariableFPS} + m := map[string]int{"NoOp": config.FilterNoOp, "MOG": config.FilterMOG, "VariableFPS": config.FilterVariableFPS, "KNN": config.FilterKNN} v, ok := m[value] if !ok { r.cfg.Logger.Log(logger.Warning, pkg+"invalid FilterMethod param", "value", value) From 0da2d3182a306348a197d3a8a9f7f6184d6c98d8 Mon Sep 17 00:00:00 2001 From: Ella Pietraroia Date: Mon, 23 Dec 2019 14:59:48 +1030 Subject: [PATCH 07/15] adding knn.go file --- filter/knn.go | 127 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 filter/knn.go diff --git a/filter/knn.go b/filter/knn.go new file mode 100644 index 00000000..efa43862 --- /dev/null +++ b/filter/knn.go @@ -0,0 +1,127 @@ +/* +DESCRIPTION + A filter that detects motion and discards frames without motion. The + filter uses a Mixture of Gaussians method (KNN) to determine what is + background and what is foreground. + +AUTHORS + Scott Barnard + +LICENSE + KNN.go is Copyright (C) 2019 the Australian Ocean Lab (AusOcean) + + It is free software: you can redistribute it and/or modify them + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + It is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + in gpl.txt. If not, see http://www.gnu.org/licenses. +*/ + +package filter + +import ( + "image" + "image/color" + "io" + + "gocv.io/x/gocv" +) + +// KNNFilter is a filter that provides basic motion detection. KNN is short for +// Mixture of Gaussians method. +type KNNFilter struct { + dst io.WriteCloser + area float64 + bs *gocv.BackgroundSubtractorKNN + knl gocv.Mat + debug bool + windows []*gocv.Window +} + +// NewKNNFilter returns a pointer to a new KNNFilter. +func NewKNNFilter(dst io.WriteCloser, area, threshold float64, history, kernelSize int, debug bool) *KNNFilter { + bs := gocv.NewBackgroundSubtractorKNNWithParams(history, threshold, false) + k := gocv.GetStructuringElement(gocv.MorphRect, image.Pt(kernelSize, kernelSize)) + var windows []*gocv.Window + if debug { + windows = []*gocv.Window{gocv.NewWindow("Debug: Bounding boxes"), gocv.NewWindow("Debug: Motion")} + } + return &KNNFilter{dst, area, &bs, k, debug, windows} +} + +// Implements io.Closer. +// Close frees resources used by gocv, because it has to be done manually, due to +// it using c-go. +func (m *KNNFilter) Close() error { + m.bs.Close() + m.knl.Close() + for _, window := range m.windows { + window.Close() + } + return nil +} + +// Implements io.Writer. +// 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) { + img, _ := gocv.IMDecode(f, gocv.IMReadColor) + defer img.Close() + + imgDelta := gocv.NewMat() + defer imgDelta.Close() + + // Seperate foreground and background. + m.bs.Apply(img, &imgDelta) + + // Threshold imgDelta. + gocv.Threshold(imgDelta, &imgDelta, 25, 255, gocv.ThresholdBinary) + + // Remove noise. + gocv.Erode(imgDelta, &imgDelta, m.knl) + gocv.Dilate(imgDelta, &imgDelta, m.knl) + + // Fill small holes. + gocv.Dilate(imgDelta, &imgDelta, m.knl) + gocv.Erode(imgDelta, &imgDelta, m.knl) + + // Find contours and reject ones with a small area. + var contours [][]image.Point + allContours := gocv.FindContours(imgDelta, gocv.RetrievalExternal, gocv.ChainApproxSimple) + for _, c := range allContours { + if gocv.ContourArea(c) > m.area { + contours = append(contours, c) + } + } + + // Draw debug information. + if m.debug { + for _, c := range contours { + rect := gocv.BoundingRect(c) + gocv.Rectangle(&img, rect, color.RGBA{0, 0, 255, 0}, 1) + } + + if len(contours) > 0 { + gocv.PutText(&img, "Motion", image.Pt(32, 32), gocv.FontHersheyPlain, 2.0, color.RGBA{255, 0, 0, 0}, 2) + } + + m.windows[0].IMShow(img) + m.windows[1].IMShow(imgDelta) + m.windows[0].WaitKey(1) + } + + // Don't write to destination if there is no motion. + if len(contours) == 0 { + return -1, nil + } + + // Write to destination. + return m.dst.Write(f) +} From 197fbcf24221a3b5bf159dc5e1b046f9c18d092b Mon Sep 17 00:00:00 2001 From: Ella Pietraroia Date: Tue, 31 Dec 2019 13:26:36 +1030 Subject: [PATCH 08/15] chaning parameters of filter --- revid/revid.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/revid/revid.go b/revid/revid.go index 33e3b498..5f4df7d8 100644 --- a/revid/revid.go +++ b/revid/revid.go @@ -336,7 +336,7 @@ func (r *Revid) setupPipeline(mtsEnc func(dst io.WriteCloser, rate float64) (io. case config.FilterVariableFPS: r.filter = filter.NewVariableFPSFilter(r.encoders, 1.0, filter.NewMOGFilter(r.encoders, 25, 20, 500, 3, true)) case config.FilterKNN: - r.filter = filter.NewKNNFilter(r.encoders, 25, 20, 500, 3, true) + r.filter = filter.NewKNNFilter(r.encoders, 25, 300, 300, 9, true) default: panic("Undefined Filter") } From 6d45572a8221b085b44fd2bda7e1667b803d2dbf Mon Sep 17 00:00:00 2001 From: Ella Pietraroia Date: Tue, 31 Dec 2019 13:37:47 +1030 Subject: [PATCH 09/15] Documentation comments --- filter/knn.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/filter/knn.go b/filter/knn.go index efa43862..3e494253 100644 --- a/filter/knn.go +++ b/filter/knn.go @@ -1,11 +1,11 @@ /* DESCRIPTION A filter that detects motion and discards frames without motion. The - filter uses a Mixture of Gaussians method (KNN) to determine what is + filter uses a K-Nearest Neighbours (KNN) to determine what is background and what is foreground. AUTHORS - Scott Barnard + Ella Pietraroia LICENSE KNN.go is Copyright (C) 2019 the Australian Ocean Lab (AusOcean) @@ -35,7 +35,7 @@ import ( ) // KNNFilter is a filter that provides basic motion detection. KNN is short for -// Mixture of Gaussians method. +// K-Nearest Neighbours method. type KNNFilter struct { dst io.WriteCloser area float64 From 8ebfa0a7fbbb58c0769686b947a07f3c3b66e092 Mon Sep 17 00:00:00 2001 From: Ella Pietraroia Date: Tue, 31 Dec 2019 15:18:06 +1030 Subject: [PATCH 10/15] adding constants for the integer arguments --- revid/revid.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/revid/revid.go b/revid/revid.go index 5f4df7d8..fd3f83cf 100644 --- a/revid/revid.go +++ b/revid/revid.go @@ -76,6 +76,15 @@ const ( rtmpConnectionTimeout = 10 ) +// KNN filter properties +const ( + knnMinArea = 25.0 + knnThreshold = 300 + knnHistory = 300 + knnKernel = 9 + knnShowWindows = true +) + const pkg = "revid: " type Logger interface { @@ -336,7 +345,7 @@ func (r *Revid) setupPipeline(mtsEnc func(dst io.WriteCloser, rate float64) (io. case config.FilterVariableFPS: r.filter = filter.NewVariableFPSFilter(r.encoders, 1.0, filter.NewMOGFilter(r.encoders, 25, 20, 500, 3, true)) case config.FilterKNN: - r.filter = filter.NewKNNFilter(r.encoders, 25, 300, 300, 9, true) + r.filter = filter.NewKNNFilter(r.encoders, knnMinArea, knnThreshold, knnHistory, knnKernel, knnShowWindows) default: panic("Undefined Filter") } From 40b5374856dca766aab2086754774ed4fb8277fa Mon Sep 17 00:00:00 2001 From: Ella Pietraroia Date: Tue, 31 Dec 2019 15:22:57 +1030 Subject: [PATCH 11/15] fixing circleci build problem with knn filter --- filter/filters_circleci.go | 4 ++++ filter/knn.go | 2 ++ 2 files changed, 6 insertions(+) diff --git a/filter/filters_circleci.go b/filter/filters_circleci.go index b5286f97..b6ebcc70 100644 --- a/filter/filters_circleci.go +++ b/filter/filters_circleci.go @@ -35,3 +35,7 @@ import ( func NewMOGFilter(dst io.WriteCloser, area, threshold float64, history, kernelSize int, debug bool) *NoOp { return &NoOp{dst: dst} } + +func NewKNNFilter(dst io.WriteCloser, area, threshold float64, history, kernelSize int, debug bool) *KNNFilter { + return &NoOp{dst: dst} +} diff --git a/filter/knn.go b/filter/knn.go index 3e494253..d4eb13ed 100644 --- a/filter/knn.go +++ b/filter/knn.go @@ -1,4 +1,6 @@ /* +// +build !circleci + DESCRIPTION A filter that detects motion and discards frames without motion. The filter uses a K-Nearest Neighbours (KNN) to determine what is From 8c32265ae367f91f28b095a025e060e96893177b Mon Sep 17 00:00:00 2001 From: Ella Pietraroia Date: Tue, 31 Dec 2019 15:29:58 +1030 Subject: [PATCH 12/15] error message for decoding image --- filter/knn.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/filter/knn.go b/filter/knn.go index d4eb13ed..cc65d1de 100644 --- a/filter/knn.go +++ b/filter/knn.go @@ -29,6 +29,7 @@ LICENSE package filter import ( + "fmt" "image" "image/color" "io" @@ -74,7 +75,10 @@ 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) { - img, _ := gocv.IMDecode(f, gocv.IMReadColor) + img, err := gocv.IMDecode(f, gocv.IMReadColor) + if err != nil { + return 0, fmt.Errorf("can't decode image: %w", err) + } defer img.Close() imgDelta := gocv.NewMat() From 062b341e683f0db69dbf2ae5066ada551de201f9 Mon Sep 17 00:00:00 2001 From: Ella Pietraroia Date: Tue, 31 Dec 2019 15:39:09 +1030 Subject: [PATCH 13/15] fixing merge problems --- filter/knn.go | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/filter/knn.go b/filter/knn.go index 74abe098..cc65d1de 100644 --- a/filter/knn.go +++ b/filter/knn.go @@ -1,9 +1,6 @@ /* -<<<<<<< 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 @@ -32,10 +29,7 @@ LICENSE package filter import ( -<<<<<<< HEAD "fmt" -======= ->>>>>>> 65f1c89ff2220eb828dcec312da11dbc620449bc "image" "image/color" "io" @@ -81,14 +75,10 @@ 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() From f06d9641c80ae08b1eca3bc3e6e51a9b72e5c7e4 Mon Sep 17 00:00:00 2001 From: Ella Pietraroia Date: Tue, 31 Dec 2019 15:40:47 +1030 Subject: [PATCH 14/15] moving build !circleci --- filter/knn.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/filter/knn.go b/filter/knn.go index cc65d1de..4ce51d9e 100644 --- a/filter/knn.go +++ b/filter/knn.go @@ -1,6 +1,6 @@ -/* // +build !circleci +/* DESCRIPTION A filter that detects motion and discards frames without motion. The filter uses a K-Nearest Neighbours (KNN) to determine what is From ab211be6ebc5b29f78f571c054d422731db47e28 Mon Sep 17 00:00:00 2001 From: Ella Pietraroia Date: Tue, 31 Dec 2019 16:10:09 +1030 Subject: [PATCH 15/15] filter/filters_circleci.go fix type to NoOp --- filter/filters_circleci.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/filter/filters_circleci.go b/filter/filters_circleci.go index b6ebcc70..e9fc155a 100644 --- a/filter/filters_circleci.go +++ b/filter/filters_circleci.go @@ -36,6 +36,6 @@ func NewMOGFilter(dst io.WriteCloser, area, threshold float64, history, kernelSi return &NoOp{dst: dst} } -func NewKNNFilter(dst io.WriteCloser, area, threshold float64, history, kernelSize int, debug bool) *KNNFilter { +func NewKNNFilter(dst io.WriteCloser, area, threshold float64, history, kernelSize int, debug bool) *NoOp { return &NoOp{dst: dst} }