From d44e795ea26cfcf26d351165f48afc8db781a6c1 Mon Sep 17 00:00:00 2001 From: Ella Pietraroia Date: Mon, 23 Dec 2019 14:58:35 +1030 Subject: [PATCH] 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)