forked from openpifpaf/openpifpaf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathartwork.py
32 lines (26 loc) · 1.04 KB
/
artwork.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import openpifpaf
from openpifpaf.plugins.coco.constants import (
COCO_KEYPOINTS,
COCO_PERSON_SKELETON,
COCO_UPRIGHT_POSE,
)
def main():
ann = openpifpaf.Annotation(keypoints=COCO_KEYPOINTS, skeleton=COCO_PERSON_SKELETON)
ann.set(COCO_UPRIGHT_POSE, fixed_score='')
# favicon
keypoint_painter = openpifpaf.show.KeypointPainter(
line_width=48, marker_size=0)
with openpifpaf.show.Canvas.annotation(ann, filename='favicon.png',
margin=0.8, frameon=False, fig_w=5) as ax:
ax.set_aspect('equal')
keypoint_painter.annotation(ax, ann)
# logo
keypoint_painter = openpifpaf.show.KeypointPainter(
line_width=12)
with openpifpaf.show.Canvas.annotation(ann, filename='logo.png') as ax:
keypoint_painter.annotation(ax, ann)
with openpifpaf.show.Canvas.annotation(ann, filename='logo_square.png', frameon=False, fig_w=5) as ax:
ax.set_aspect('equal')
keypoint_painter.annotation(ax, ann)
if __name__ == '__main__':
main()