Made variable for showing windows

This commit is contained in:
Scott 2020-01-02 11:45:36 +10:30
parent d7fa1569a4
commit 55981f8ae9
2 changed files with 18 additions and 3 deletions

View File

@ -236,6 +236,10 @@ type Config struct {
// of the file.
Exposure string
// ShowWindows enables or disables the display of windows used for debugging
// motion filters.
ShowWindows bool
// AutoWhiteBalance defines the auto white balance mode used by Raspivid input.
// Valid modes are defined in the exported []string AutoWhiteBalanceModes
// defined at the start of the file.
@ -304,6 +308,7 @@ var TypeData = map[string]string{
"RTMPURL": "string",
"RTPAddress": "string",
"Saturation": "int",
"ShowWindows": "bool",
"VBRBitrate": "int",
"VBRQuality": "enum:standard,fair,good,great,excellent",
"VerticalFlip": "bool",

View File

@ -350,11 +350,11 @@ func (r *Revid) setupPipeline(mtsEnc func(dst io.WriteCloser, rate float64) (io.
case config.FilterNoOp:
r.filter = filter.NewNoOp(r.encoders)
case config.FilterMOG:
r.filter = filter.NewMOGFilter(r.encoders, mogMinArea, mogThreshold, mogHistory, showWindows)
r.filter = filter.NewMOGFilter(r.encoders, mogMinArea, mogThreshold, mogHistory, r.cfg.ShowWindows)
case config.FilterVariableFPS:
r.filter = filter.NewVariableFPSFilter(r.encoders, minFPS, filter.NewMOGFilter(r.encoders, mogMinArea, mogThreshold, mogHistory, showWindows))
r.filter = filter.NewVariableFPSFilter(r.encoders, minFPS, filter.NewMOGFilter(r.encoders, mogMinArea, mogThreshold, mogHistory, r.cfg.ShowWindows))
case config.FilterKNN:
r.filter = filter.NewKNNFilter(r.encoders, knnMinArea, knnThreshold, knnHistory, knnKernel, showWindows)
r.filter = filter.NewKNNFilter(r.encoders, knnMinArea, knnThreshold, knnHistory, knnKernel, r.cfg.ShowWindows)
default:
panic("Undefined Filter")
@ -773,6 +773,16 @@ func (r *Revid) Update(vars map[string]string) error {
break
}
r.cfg.CameraChan = v
case "ShowWindows":
switch strings.ToLower(value) {
case "true":
r.cfg.ShowWindows = true
case "false":
r.cfg.ShowWindows = false
default:
r.cfg.Logger.Log(logger.Warning, pkg+"invalid ShowWindows var", "value", value)
break
}
}
}
r.cfg.Logger.Log(logger.Info, pkg+"revid config changed", "config", fmt.Sprintf("%+v", r.cfg))