示例#1
0
def produceSkeletonData(frameNumber, humans, image):
    image_h, image_w = image.shape[:2]
    skeleton = {"frameNumber": frameNumber, "score": 0, "keypoints": []}

    for human in humans:
        for i in range(common.CocoPart.Background.value):
            if i not in human.body_parts.keys():
                continue
            else:
                body_part = human.body_parts[i]
                keypoint = {
                    "position": {
                        "x": body_part.x * image_w,
                        "y": body_part.y * image_h
                    },
                    "partName": CocoPart(body_part.part_idx).name,
                    "score": body_part.score
                }
                skeleton['keypoints'].append(keypoint)
                skeleton['score'] = human.score

    return skeleton
示例#2
0
文件: estimator.py 项目: webVJ/models
 def get_part_name(self):
     return CocoPart(self.part_idx)