mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-05 10:45:21 +03:00
ensure mask is applied after contrast improvement
This commit is contained in:
parent
cb38323bca
commit
b3a6470d83
@ -61,17 +61,9 @@ class ImprovedMotionDetector(MotionDetector):
|
|||||||
interpolation=self.interpolation,
|
interpolation=self.interpolation,
|
||||||
)
|
)
|
||||||
|
|
||||||
# mask frame
|
|
||||||
resized_frame[self.mask] = [255]
|
|
||||||
|
|
||||||
if self.save_images:
|
if self.save_images:
|
||||||
resized_saved = resized_frame.copy()
|
resized_saved = resized_frame.copy()
|
||||||
|
|
||||||
resized_frame = gaussian_filter(resized_frame, sigma=1, radius=self.blur_radius)
|
|
||||||
|
|
||||||
if self.save_images:
|
|
||||||
blurred_saved = resized_frame.copy()
|
|
||||||
|
|
||||||
# Improve contrast
|
# Improve contrast
|
||||||
if self.improve_contrast.value:
|
if self.improve_contrast.value:
|
||||||
# TODO tracking moving average of min/max to avoid sudden contrast changes
|
# TODO tracking moving average of min/max to avoid sudden contrast changes
|
||||||
@ -95,6 +87,15 @@ class ImprovedMotionDetector(MotionDetector):
|
|||||||
if self.save_images:
|
if self.save_images:
|
||||||
contrasted_saved = resized_frame.copy()
|
contrasted_saved = resized_frame.copy()
|
||||||
|
|
||||||
|
# mask frame
|
||||||
|
# this has to come after contrast improvement
|
||||||
|
resized_frame[self.mask] = [255]
|
||||||
|
|
||||||
|
resized_frame = gaussian_filter(resized_frame, sigma=1, radius=self.blur_radius)
|
||||||
|
|
||||||
|
if self.save_images:
|
||||||
|
blurred_saved = resized_frame.copy()
|
||||||
|
|
||||||
if self.save_images or self.calibrating:
|
if self.save_images or self.calibrating:
|
||||||
self.frame_counter += 1
|
self.frame_counter += 1
|
||||||
# compare to average
|
# compare to average
|
||||||
@ -155,8 +156,8 @@ class ImprovedMotionDetector(MotionDetector):
|
|||||||
)
|
)
|
||||||
frames = [
|
frames = [
|
||||||
cv2.cvtColor(resized_saved, cv2.COLOR_GRAY2BGR),
|
cv2.cvtColor(resized_saved, cv2.COLOR_GRAY2BGR),
|
||||||
cv2.cvtColor(blurred_saved, cv2.COLOR_GRAY2BGR),
|
|
||||||
cv2.cvtColor(contrasted_saved, cv2.COLOR_GRAY2BGR),
|
cv2.cvtColor(contrasted_saved, cv2.COLOR_GRAY2BGR),
|
||||||
|
cv2.cvtColor(blurred_saved, cv2.COLOR_GRAY2BGR),
|
||||||
cv2.cvtColor(frameDelta, cv2.COLOR_GRAY2BGR),
|
cv2.cvtColor(frameDelta, cv2.COLOR_GRAY2BGR),
|
||||||
cv2.cvtColor(thresh, cv2.COLOR_GRAY2BGR),
|
cv2.cvtColor(thresh, cv2.COLOR_GRAY2BGR),
|
||||||
thresh_dilated,
|
thresh_dilated,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user