mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
avoid divide by zero
This commit is contained in:
parent
9b23ff597c
commit
543a8a1712
@ -40,10 +40,12 @@ class MotionDetector:
|
|||||||
# Improve contrast
|
# Improve contrast
|
||||||
minval = np.percentile(resized_frame, 4)
|
minval = np.percentile(resized_frame, 4)
|
||||||
maxval = np.percentile(resized_frame, 96)
|
maxval = np.percentile(resized_frame, 96)
|
||||||
resized_frame = np.clip(resized_frame, minval, maxval)
|
# don't adjust if the image is a single color
|
||||||
resized_frame = (((resized_frame - minval) / (maxval - minval)) * 255).astype(
|
if minval < maxval:
|
||||||
np.uint8
|
resized_frame = np.clip(resized_frame, minval, maxval)
|
||||||
)
|
resized_frame = (
|
||||||
|
((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