Skip to content

Commit

Permalink
[Feature] Add center alignments for opencv backend visualizer (#2958)
Browse files Browse the repository at this point in the history
  • Loading branch information
AntDum authored Feb 19, 2024
1 parent 2a732e8 commit 10f98b5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mmpose/visualization/opencv_backend_visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,13 @@ def draw_texts(
x = int(positions[0])
if horizontal_alignments == 'right':
x = max(0, x - text_size[0])
elif horizontal_alignments == 'center':
x = max(0, x - text_size[0] // 2)
y = int(positions[1])
if vertical_alignments == 'top':
y = min(self.height, y + text_size[1])
elif vertical_alignments == 'center':
y = min(self.height, y + text_size[1] // 2)

if bboxes is not None:
bbox_color = bboxes[0]['facecolor']
Expand Down

0 comments on commit 10f98b5

Please sign in to comment.