Skip to content

Commit 10f98b5

Browse files
authored
[Feature] Add center alignments for opencv backend visualizer (#2958)
1 parent 2a732e8 commit 10f98b5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Diff for: mmpose/visualization/opencv_backend_visualizer.py

+4
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,13 @@ def draw_texts(
240240
x = int(positions[0])
241241
if horizontal_alignments == 'right':
242242
x = max(0, x - text_size[0])
243+
elif horizontal_alignments == 'center':
244+
x = max(0, x - text_size[0] // 2)
243245
y = int(positions[1])
244246
if vertical_alignments == 'top':
245247
y = min(self.height, y + text_size[1])
248+
elif vertical_alignments == 'center':
249+
y = min(self.height, y + text_size[1] // 2)
246250

247251
if bboxes is not None:
248252
bbox_color = bboxes[0]['facecolor']

0 commit comments

Comments
 (0)