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 7c42f9dc1b
commit a02a60b008
2 changed files with 4 additions and 1 deletions

View File

@ -113,6 +113,7 @@ const (
FilterNoOp = iota
FilterMOG
FilterVariableFPS
FilterKNN
)
// 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)
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)