Skip to content
This repository has been archived by the owner on Aug 5, 2023. It is now read-only.

drawing bbox #11

Open
SaddamBInSyed opened this issue Jun 8, 2020 · 2 comments
Open

drawing bbox #11

SaddamBInSyed opened this issue Jun 8, 2020 · 2 comments

Comments

@SaddamBInSyed
Copy link

Hi I have tried the below code to draw bbox around hand but not drawing properly

(handtracker.py)

bounding box offsets, width and height

    dx, dy, w, h = candidate_detect[box_ids, :4]

bbox_dict = {
"x": dx,
"y": dy,
"w": w,
"h": h
}
cv2.rectangle(frame, (bbox_dict['x'], bbox_dict['y']),
(bbox_dict['x'] + bbox_dict['w'], bbox_dict['y'] + bbox_dict['h']), (0, 255, 0), 1)

please advise

@patrickwf
Copy link

patrickwf commented Jul 3, 2020

Hi I have tried the below code to draw bbox around hand but not drawing properly

(handtracker.py)

bounding box offsets, width and height

    dx, dy, w, h = candidate_detect[box_ids, :4]

bbox_dict = {
"x": dx,
"y": dy,
"w": w,
"h": h
}
cv2.rectangle(frame, (bbox_dict['x'], bbox_dict['y']),
(bbox_dict['x'] + bbox_dict['w'], bbox_dict['y'] + bbox_dict['h']), (0, 255, 0), 1)

please advise

hi,SaddamBInSyed

you can modify the code in "run.py" like this :
points, _ = detector(image) -> points, bbox = detector(image)

then ,draw bbox :

if bbox is not None:
    bbox_pt = np.array(bbox ,dtype=np.int)
    bbox_pt = np.reshape(bbox_pt,(-1,4,2))
    cv2.polylines(frame,bbox_pt,1,POINT_COLOR,THICKNESS)

@akshayvernekar
Copy link

Hi @patrickwf your code works, could you tell me how can we use the bx, by, w and h provided by the model to draw bounding box ? Also I am not able to understand why do we need to use anchors.csv file.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants