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)