Perhaps I am understanding what berak was saying, there seems to be a problem in detecting the contour… when I used findcontour() and then applied bounding rect() function the output was correct
for eg for this array
[[ 0 0 0]
[ 0 0 0]
[ 0 0 0]
[255 255 255]]
By using boundingrect(img):(0, 3, 1, 1)
By using
contours, _ = cv2.findContours(img,cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) and then boundingrect(contours):(0, 3, 3, 1)
So can anyone point out the file in which detection of contours takes place specifically for bounding rect
I even performed dry run on the boundingrect() function present in modules/core/src/types.cpp (Hope I am correct this time!) for
img = np.array([
[0, 0, 0, 0, 0],
[1, 1, 1, 0, 0],
], np.uint8)
by using findcontours and then boxpoint function to find the coordinates of the rotated rectangle and then dry running the below program:
and the dry run output is coming correct that is (0 ,1 ,3 ,1)
So Can you please provide me with the file or code using which bounding rect finds the contour.
I even saw the scatterplot provided #24217 . Can you provide me with more explanation on the same if possible… regarding the pattern …like (odd,even) combination of (w,h) is yeilding wrong output?
Thanks