Ensure bounding box is within camera frame

This commit is contained in:
Nick Mowen 2022-08-23 12:09:21 -06:00
parent 0cf759acad
commit 70c05978a4

View File

@ -647,12 +647,13 @@ def process_frames(
# apply non-maxima suppression to suppress weak, overlapping bounding boxes # apply non-maxima suppression to suppress weak, overlapping bounding boxes
# o[2] is the box of the object: xmin, ymin, xmax, ymax # o[2] is the box of the object: xmin, ymin, xmax, ymax
# apply max/min to ensure values do not exceed the known frame size
boxes = [ boxes = [
( (
o[2][0], max(o[2][0], 0),
o[2][1], max(o[2][1], 0),
o[2][2] - o[2][0], min(o[2][2] - o[2][0], detect_config.width),
o[2][3] - o[2][1], min(o[2][3] - o[2][1], detect_config.height),
) )
for o in group for o in group
] ]