make dynamic contrast optional and disable by default

This commit is contained in:
Blake Blackshear 2022-03-10 07:43:12 -06:00
parent 0dfba6e8d9
commit b1a2b0cda2
3 changed files with 15 additions and 9 deletions

View File

@ -236,6 +236,10 @@ motion:
# Optional: motion mask
# NOTE: see docs for more detailed info on creating masks
mask: 0,900,1080,900,1080,1920,0,1920
# Optional: improve contrast (default: shown below)
# Enables dynamic contrast improvement. This should help improve night detections at the cost of making motion detection more sensitive
# for daytime.
improve_contrast: False
# Optional: Record configuration
# NOTE: Can be overridden at the camera level

View File

@ -122,6 +122,7 @@ class MotionConfig(FrigateBaseModel):
ge=1,
le=255,
)
improve_contrast: bool = Field(default=False, title="Improve Contrast")
contour_area: Optional[int] = Field(default=30, title="Contour Area")
delta_alpha: float = Field(default=0.2, title="Delta Alpha")
frame_alpha: float = Field(default=0.2, title="Frame Alpha")

View File

@ -38,6 +38,7 @@ class MotionDetector:
)
# Improve contrast
if self.config.improve_contrast:
minval = np.percentile(resized_frame, 4)
maxval = np.percentile(resized_frame, 96)
# don't adjust if the image is a single color