foolwood / foolwood/SiamMask

How to create Axis-aligned bounding boxes

Open
#141 0 comments 0 reactions 0 assignees View on GitHub
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:

![image](https://user-images.githubusercontent.com/9627710/74807833-a242eb00-5313-11ea-9a5d-ea9cd66abe48.png)

Then if I delete the flatten() function in demo.py, I do not get errors but bounding boxes are not correct.
![image](https://user-images.githubusercontent.com/9627710/74807717-56904180-5313-11ea-82dc-d01fa86acd32.png)

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.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.