Is there a way of detecting and finding the width of only the largest rectangle in the cameras field of vision?
The attached image shows two rectangles being detected, however, I require only the windscreen (largest width rectangle) of the vehicle to be detected at various distances from the camera.
Code:
while(True):
img = sensor.snapshot()
img.draw_rectangle((90, 70, 130, 90), color = (255, 0, 0), thickness = 2)
for r in img.find_rects(roi= (90, 70, 130, 90), threshold=35000):
img.draw_rectangle(r.rect(), color = (0, 255, 0), thickness = 2)