I have set the left side of red line vertically as the region of interest. Trained a model to detect licence plate where boxes contains the detected object coordinates within ROI. The bounding box appears even before the entire object is within the region of interest. I want the bounding box to appear only after the entire object is within the ROI. This is my code for the bounding box.
x, y, w, h = boxes1[i]
label = ""
color = (0, 0, 255)
cv2.rectangle(frame, (x, y), (x + w, y + h), color, 2)
Draw the rectangle only if x + w
is at the left side of the red line.
red_line_x = 200 # for example
x, y, w, h = boxes1[i]
if (x + w) < red_line_x:
color = (0, 0, 255)
cv2.rectangle(frame, (x, y), (x + w, y + h), color, 2)