mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-02-23 00:18:31 +01:00
make dynamic contrast optional and disable by default
This commit is contained in:
parent
0dfba6e8d9
commit
b1a2b0cda2
@ -171,7 +171,7 @@ detect:
|
|||||||
# It can also be used to disable stationary object tracking. For example, you may want to set a value for person, but leave
|
# It can also be used to disable stationary object tracking. For example, you may want to set a value for person, but leave
|
||||||
# car at the default.
|
# car at the default.
|
||||||
# WARNING: Setting these values overrides default behavior and disables stationary object tracking.
|
# WARNING: Setting these values overrides default behavior and disables stationary object tracking.
|
||||||
# There are very few situations where you would want it disabled. It is NOT recommended to
|
# There are very few situations where you would want it disabled. It is NOT recommended to
|
||||||
# copy these values from the example config into your config unless you know they are needed.
|
# copy these values from the example config into your config unless you know they are needed.
|
||||||
max_frames:
|
max_frames:
|
||||||
# Optional: Default for all object types (default: not set, track forever)
|
# Optional: Default for all object types (default: not set, track forever)
|
||||||
@ -236,6 +236,10 @@ motion:
|
|||||||
# Optional: motion mask
|
# Optional: motion mask
|
||||||
# NOTE: see docs for more detailed info on creating masks
|
# NOTE: see docs for more detailed info on creating masks
|
||||||
mask: 0,900,1080,900,1080,1920,0,1920
|
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
|
# Optional: Record configuration
|
||||||
# NOTE: Can be overridden at the camera level
|
# NOTE: Can be overridden at the camera level
|
||||||
|
@ -122,6 +122,7 @@ class MotionConfig(FrigateBaseModel):
|
|||||||
ge=1,
|
ge=1,
|
||||||
le=255,
|
le=255,
|
||||||
)
|
)
|
||||||
|
improve_contrast: bool = Field(default=False, title="Improve Contrast")
|
||||||
contour_area: Optional[int] = Field(default=30, title="Contour Area")
|
contour_area: Optional[int] = Field(default=30, title="Contour Area")
|
||||||
delta_alpha: float = Field(default=0.2, title="Delta Alpha")
|
delta_alpha: float = Field(default=0.2, title="Delta Alpha")
|
||||||
frame_alpha: float = Field(default=0.2, title="Frame Alpha")
|
frame_alpha: float = Field(default=0.2, title="Frame Alpha")
|
||||||
|
@ -38,14 +38,15 @@ class MotionDetector:
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Improve contrast
|
# Improve contrast
|
||||||
minval = np.percentile(resized_frame, 4)
|
if self.config.improve_contrast:
|
||||||
maxval = np.percentile(resized_frame, 96)
|
minval = np.percentile(resized_frame, 4)
|
||||||
# don't adjust if the image is a single color
|
maxval = np.percentile(resized_frame, 96)
|
||||||
if minval < maxval:
|
# don't adjust if the image is a single color
|
||||||
resized_frame = np.clip(resized_frame, minval, maxval)
|
if minval < maxval:
|
||||||
resized_frame = (
|
resized_frame = np.clip(resized_frame, minval, maxval)
|
||||||
((resized_frame - minval) / (maxval - minval)) * 255
|
resized_frame = (
|
||||||
).astype(np.uint8)
|
((resized_frame - minval) / (maxval - minval)) * 255
|
||||||
|
).astype(np.uint8)
|
||||||
|
|
||||||
# mask frame
|
# mask frame
|
||||||
resized_frame[self.mask] = [255]
|
resized_frame[self.mask] = [255]
|
||||||
|
Loading…
Reference in New Issue
Block a user