Skip to content

Labels new edge can disappear #1818

Open
@hidara2000

Description

@hidara2000

Search before asking

  • I have searched the Supervision issues and found no similar feature requests.

Description

When using label annotator if the box is close to an edge and the text is on the edge side disappears off frame.

Add an option to ensure it stays fully in the frame

Use case

Suggested approach

in the .annotate function labels near the top can be moved inside the bounding box using something similar to

for i in range(label_properties.shape[0]):
     if label_properties[i, 1] < 0:
         spacing = 3
         offset = spacing + self.text_padding + self.font.size
         label_properties[i, :] = label_properties[i, :] + [0,offset,0,offset,0,0]

Additional

No response

Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions