fix masks

This commit is contained in:
Blake Blackshear 2020-09-10 17:37:58 -05:00
parent fedeeab561
commit c16ee3186f

View File

@ -83,7 +83,7 @@ def filtered(obj, objects_to_track, object_filters, mask=None):
x_location = min(int((obj[2][2]-obj[2][0])/2.0)+obj[2][0], len(mask[0])-1) x_location = min(int((obj[2][2]-obj[2][0])/2.0)+obj[2][0], len(mask[0])-1)
# if the object is in a masked location, don't add it to detected objects # if the object is in a masked location, don't add it to detected objects
if (not mask is None) and (mask[y_location][x_location][0] == 0): if (not mask is None) and (mask[y_location][x_location] == 0):
return True return True
return False return False
@ -208,7 +208,7 @@ def track_camera(name, config, frame_queue, frame_shape, detection_queue, detect
mask = None mask = None
if mask is None: if mask is None:
mask = np.zeros((frame_shape[0], frame_shape[1], 1), np.uint8) mask = np.zeros((frame_shape[0], frame_shape[1]), np.uint8)
mask[:] = 255 mask[:] = 255
motion_detector = MotionDetector(frame_shape, mask, resize_factor=6) motion_detector = MotionDetector(frame_shape, mask, resize_factor=6)