求助帖python人体关键点识别
kkive康康 发布于2019-05 浏览:824 回复:0
0
收藏
最后编辑于2019-06

以下是源代码

from aip import AipBodyAnalysis

""" 你的 APPID AK SK """
APP_ID = '161**775'
API_KEY = 'j9Kn9bYH*****Fs4yjETnxPF'
SECRET_KEY = 'YpNfHUbmSM*****LftKcTMxW1hfCxVvO'
aippoint = AipBodyAnalysis(APP_ID, API_KEY, SECRET_KEY)

#打开图片
filepath = "test2.jpg"

""" 读取图片 """
def get_file_content(filePath):
    with open(filePath, 'rb') as c:
        return c.read()

""" 调用人体关键点识别 """
request = aippoint.bodyAnalysis(get_file_content(filepath))
print(request

以下是返回的代码

C:\Users\AAA\AppData\Local\Programs\Python\Python37-32\python.exe C:/Users/AAA/PycharmProjects/百度ai图像识别/人体关键点识别.py
{'person_num': 2, 'person_info': [{'body_parts': {'neck': {'y': 1599.686401367188, 'x': 458.505615234375}, 'left_shoulder': {'y': 1610.757202148438, 'x': 666.5679931640625}, 'left_knee': {'y': 2727.963134765625, 'x': 557.4421997070312}, 'left_ankle': {'y': 3101.0478515625, 'x': 524.4240112304688}, 'right_elbow': {'y': 1884.62060546875, 'x': 109.440315246582}, 'nose': {'y': 1435.671997070312, 'x': 480.7627563476562}, 'left_hip': {'y': 2246.15673828125, 'x': 568.5053100585938}, 'right_hip': {'y': 2257.05810546875, 'x': 305.9986877441406}, 'left_wrist': {'y': 1862.303344726562, 'x': 612.0584106445312}, 'left_elbow': {'y': 1895.845336914062, 'x': 743.6417846679688}, 'right_shoulder': {'y': 1577.795043945312, 'x': 207.8418273925781}, 'right_ankle': {'y': 3177.5185546875, 'x': 316.759765625}, 'right_knee': {'y': 2750.34423828125, 'x': 305.9797058105469}, 'right_wrist': {'y': 1808.217895507812, 'x': 305.7801818847656}}, 'location': {'width': 865.7750244140625, 'top': 1164.363037109375, 'height': 2196.169677734375, 'left': 0.0}}, {'body_parts': {'neck': {'y': 1873.065795898438, 'x': 1005.85107421875}, 'left_shoulder': {'y': 1851.52783203125, 'x': 939.880615234375}, 'left_knee': {'y': 3286.843505859375, 'x': 994.5364379882812}, 'left_ankle': {'y': 3999.14404296875, 'x': 961.3614501953125}, 'right_elbow': {'y': 2060.258544921875, 'x': 1431.70849609375}, 'nose': {'y': 1698.393920898438, 'x': 1311.390747070312}, 'left_hip': {'y': 2673.611572265625, 'x': 1070.545288085938}, 'right_hip': {'y': 2684.60888671875, 'x': 1016.491088867188}, 'left_wrist': {'y': 0.0, 'x': 0.0}, 'left_elbow': {'y': 2136.6708984375, 'x': 1267.118530273438}, 'right_shoulder': {'y': 1884.048706054688, 'x': 1070.970947265625}, 'right_ankle': {'y': 3999.18017578125, 'x': 972.468994140625}, 'right_knee': {'y': 3297.73681640625, 'x': 1005.657836914062}, 'right_wrist': {'y': 1906.607543945312, 'x': 1661.015502929688}}, 'location': {'width': 1140.99609375, 'top': 1384.3974609375, 'height': 2647.6025390625, 'left': 729.9500122070312}}], 'log_id': 2025586875516843694}

进程已结束,退出代码 0

 

收藏
点赞
0
个赞
TOP
切换版块