def draw_skeletons(pose, sigmas, skel, kps, scr_weights): from openpifpaf.annotation import Annotation # pylint: disable=import-outside-toplevel from openpifpaf import show # pylint: disable=import-outside-toplevel scale = np.sqrt((np.max(pose[:, 0]) - np.min(pose[:, 0])) * (np.max(pose[:, 1]) - np.min(pose[:, 1]))) show.KeypointPainter.show_joint_scales = True keypoint_painter = show.KeypointPainter() ann = Annotation(keypoints=kps, skeleton=skel, score_weights=scr_weights) ann.set(pose, np.array(sigmas) * scale) os.makedirs('docs', exist_ok=True) draw_ann(ann, filename='docs/skeleton_car.png', keypoint_painter=keypoint_painter)
def draw_mhp_skeletons(pose): from openpifpaf.annotation import Annotation # pylint: disable=import-outside-toplevel from openpifpaf import show # pylint: disable=import-outside-toplevel scale = np.sqrt((np.max(pose[:, 0]) - np.min(pose[:, 0])) * (np.max(pose[:, 1]) - np.min(pose[:, 1]))) show.KeypointPainter.show_joint_scales = True keypoint_painter = show.KeypointPainter(color_connections=True, linewidth=6) ann = Annotation(keypoints=MHP_KEYPOINTS, skeleton=MHP_PERSON_SKELETON) ann.set(pose, np.array(MHP_PERSON_SIGMAS) * scale) draw_ann(ann, filename='skeleton_mhp.png', keypoint_painter=keypoint_painter)
def draw_skeletons(pose): from openpifpaf.annotation import Annotation # pylint: disable=import-outside-toplevel from openpifpaf import show # pylint: disable=import-outside-toplevel scale = np.sqrt((np.max(pose[:, 0]) - np.min(pose[:, 0])) * (np.max(pose[:, 1]) - np.min(pose[:, 1]))) show.KeypointPainter.show_joint_scales = True keypoint_painter = show.KeypointPainter() ann = Annotation(keypoints=ANIMAL_KEYPOINTS, skeleton=ANIMAL_SKELETON, score_weights=ANIMAL_SCORE_WEIGHTS) ann.set(pose, np.array(ANIMAL_SIGMAS) * scale) draw_ann(ann, filename='docs/skeleton_animal.png', keypoint_painter=keypoint_painter)
def draw_skeletons(pose, prefix=""): from openpifpaf.annotation import Annotation # pylint: disable=import-outside-toplevel from openpifpaf import show # pylint: disable=import-outside-toplevel scale = np.sqrt((np.max(pose[:, 0]) - np.min(pose[:, 0])) * (np.max(pose[:, 1]) - np.min(pose[:, 1]))) show.KeypointPainter.show_joint_scales = True keypoint_painter = show.KeypointPainter(line_width=2) ann = Annotation(keypoints=WHOLEBODY_KEYPOINTS, skeleton=WHOLEBODY_SKELETON, score_weights=WHOLEBODY_SCORE_WEIGHTS) ann.set(pose, np.array(WHOLEBODY_SIGMAS) * scale) draw_ann(ann, filename='./docs/' + prefix + 'skeleton_wholebody.png', keypoint_painter=keypoint_painter)
def draw_skeletons(pose): from ..annotation import Annotation # pylint: disable=import-outside-toplevel from .. import show # pylint: disable=import-outside-toplevel scale = np.sqrt((np.max(pose[:, 0]) - np.min(pose[:, 0])) * (np.max(pose[:, 1]) - np.min(pose[:, 1]))) show.KeypointPainter.show_joint_scales = True keypoint_painter = show.KeypointPainter(color_connections=True, linewidth=6) ann = Annotation(keypoints=COCO_KEYPOINTS, skeleton=COCO_PERSON_SKELETON) ann.set(pose, np.array(COCO_PERSON_SIGMAS) * scale) draw_ann(ann, filename='docs/skeleton_coco.png', keypoint_painter=keypoint_painter) ann = Annotation(keypoints=COCO_KEYPOINTS, skeleton=KINEMATIC_TREE_SKELETON) ann.set(pose, np.array(COCO_PERSON_SIGMAS) * scale) draw_ann(ann, filename='docs/skeleton_kinematic_tree.png', keypoint_painter=keypoint_painter) ann = Annotation(keypoints=COCO_KEYPOINTS, skeleton=DENSER_COCO_PERSON_SKELETON) ann.set(pose, np.array(COCO_PERSON_SIGMAS) * scale) draw_ann(ann, filename='docs/skeleton_dense.png', keypoint_painter=keypoint_painter)