-
Notifications
You must be signed in to change notification settings - Fork 247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added labels to the drawing functions #93
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great! Almost ready to merge, just a couple of comments to discuss.
norfair/drawing.py
Outdated
label_draw_position -= radius | ||
cv2.putText( | ||
frame, | ||
f"Label: {d.label}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Label" string may occupy too much space when there are many objects on the image, it may make sense to make it shorter, or optional.
norfair/drawing.py
Outdated
) | ||
] | ||
if draw_labels: | ||
lines_to_draw.append("label:{}".format(obj.label)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably better to abbreviate 'label', as it takes too much space on the image.
fd74de3
to
a070221
Compare
norfair/drawing.py
Outdated
color_by_label: Optional[bool] = False, | ||
draw_labels: Optional[bool] = False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These don't need to be optional, as optional would effectively let this variable have 3 states (true, false, None) but we only need 2.
norfair/drawing.py
Outdated
color_by_label: Optional[bool] = False, | ||
draw_labels: Optional[bool] = False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
norfair/drawing.py
Outdated
color_by_label: Optional[bool] = False, | ||
draw_labels: Optional[bool] = False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
a070221
to
534434b
Compare
Added labels to the drawing functions
Added labels to the drawing functions
Now that Norfair allows to track multiple objects from different classes within a single
Tracker
object, the modifications added in this PR make it possible to draw labels both on detections and tracked objects. It also adds the possibility to color points and bounding boxes based on the labels so that objects from the same class have the same color.Changes were made so that we keep backwards compatibility.