System information (version)
- OpenCV => 4.1.0 (opencv-contrib-python)
- Operating System / Platform => Ubuntu 18
- Compiler => VSCode
Detailed description
The rows are getting switched when I assign them to variables.
cv2.rectangle() requires top left then bottom right so I know which ones these are in my bbox[] list and can draw the rectangle. However when I try to use the same coordinates for slicing, my y's (which I assigned y1 = bbox[3], y2=bbox[1] are reversed with y1 being a larger integer than y2 so I have to slice using y2:y1 instead. I am pretty sure that I printed out bbox[] 0 to 3 as well and it was the same so not sure why those coordinates work for both cv2.rectange() and plt.Rectangle() but then not for slicing in this case.
I posted on datasciencestackexchange about it: https://datascience.stackexchange.com/questions/58308/unexplainable-reversal-of-x-y-coordinates-in-numpy-image-array?noredirect=1#comment63897_58308
Steps to reproduce
python code, please look at cv2.rectangle() at the bottom of the function so you know what top left and bottom of bbox are:
System information (version)
Detailed description
The rows are getting switched when I assign them to variables.
cv2.rectangle()requires top left then bottom right so I know which ones these are in my bbox[] list and can draw the rectangle. However when I try to use the same coordinates for slicing, myy's (which I assignedy1 = bbox[3],y2=bbox[1]are reversed with y1 being a larger integer thany2so I have to slice usingy2:y1instead. I am pretty sure that I printed outbbox[]0 to 3 as well and it was the same so not sure why those coordinates work for bothcv2.rectange()andplt.Rectangle()but then not for slicing in this case.I posted on datasciencestackexchange about it: https://datascience.stackexchange.com/questions/58308/unexplainable-reversal-of-x-y-coordinates-in-numpy-image-array?noredirect=1#comment63897_58308
Steps to reproduce
python code, please look at cv2.rectangle() at the bottom of the function so you know what top left and bottom of bbox are: