How to create Axis-aligned bounding boxes
- Dominant language
- Python
- Stars
- 3.6k
- Forks
- 804
- PR merge metrics
- No merged PRs in 30d
Description
I am trying to get axis-aligned bounding box where the original algorithm used rotated bounding boxes. corresponding lines are --
if len(contours) != 0 and np.max(cnt_area) > 100:
contour = contours[np.argmax(cnt_area)] # use max area polygon
polygon = contour.reshape(-1, 2)
pbox = cv2.boundingRect(polygon) # Min Max Rectangle
#pbox = cv2.boxPoints(cv2.minAreaRect(polygon))
box_in_img = pbox
state['ploygon'] = rbox_in_img if mask_enable else []
location = state['ploygon'].flatten()
But getting the following error:

Then if I delete the flatten() function in demo.py, I do not get errors but bounding boxes are not correct.

Please give me some suggestion to solve this issue.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.