making new knn file, plus adding knn option into variables

This commit is contained in:
Ella Pietraroia 2019-12-23 14:58:35 +10:30
parent a62c25af41
commit d44e795ea2
2 changed files with 4 additions and 1 deletions

View File

@ -113,6 +113,7 @@ const (
FilterNoOp = iota FilterNoOp = iota
FilterMOG FilterMOG
FilterVariableFPS FilterVariableFPS
FilterKNN
) )
// Config provides parameters relevant to a revid instance. A new config must // Config provides parameters relevant to a revid instance. A new config must

View File

@ -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) r.filter = filter.NewMOGFilter(r.encoders, 25, 20, 500, 3, true)
case config.FilterVariableFPS: case config.FilterVariableFPS:
r.filter = filter.NewVariableFPSFilter(r.encoders, 1.0, filter.NewMOGFilter(r.encoders, 25, 20, 500, 3, true)) 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: default:
panic("Undefined Filter") 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) r.cfg.Logger.Log(logger.Warning, pkg+"invalid VerticalFlip param", "value", value)
} }
case "Filter": 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] v, ok := m[value]
if !ok { if !ok {
r.cfg.Logger.Log(logger.Warning, pkg+"invalid FilterMethod param", "value", value) r.cfg.Logger.Log(logger.Warning, pkg+"invalid FilterMethod param", "value", value)