supervision icon indicating copy to clipboard operation
supervision copied to clipboard

Labels new edge can disappear

Open hidara2000 opened this issue 9 months ago • 3 comments

Search before asking

  • [x] 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!

hidara2000 avatar Apr 09 '25 10:04 hidara2000

Hi @hidara2000 👋🏻! Thanks so much for your interest in supervision. Would you be interested in helping us implement this feature?

SkalskiP avatar Apr 09 '25 11:04 SkalskiP

https://github.com/roboflow/supervision/pull/1820

hidara2000 avatar Apr 15 '25 12:04 hidara2000

@hidara2000 responded ;)

SkalskiP avatar Apr 16 '25 08:04 SkalskiP

This feature is now merged into develop and will be released tomorrow in supervision-0.26.0

SkalskiP avatar Jul 15 '25 12:07 SkalskiP