I need to use the selectROI function for my project. However, I just can't seem to wrap my head around the format of the coordinates. According to this link, the coordinate array should be in this form: [Top_X, Top_Y, Bottom_X, Bottom_Y]. Assuming that the top left corner starts at (0,0) for (x,y), why are my coordinates so off when I draw 3 different bounding boxes using the selectROI function?
This is what I used to create my bounding boxes and output the coordinates:
import cv2
image = cv2.imread("path")
# Select ROI
r = cv2.selectROI("select the area", image, fromCenter=False)
print('Selected bounding boxes: {}'.format(r))
The following were outputted (see the image for reference of the boxes):
box 1: (42, 18, 212, 303)
box 2: (463, 314, 108, 226)
box 3: (1215, 801, 79, 161)
image
Why do the x-values increase from 42 -> 212 -> 464 -> back to 108 -> 1125 -> back to 79... shouldn't the coordinates for the x's be increasing? And same goes for the y.