Delete baidu.py

This commit is contained in:
Yoshiko2
2022-08-11 01:30:41 +08:00
committed by GitHub
parent a89180a386
commit bb3688e67c

View File

@@ -1,25 +0,0 @@
from aip import AipBodyAnalysis
import config
def face_center(filename, model):
app_id = config.getInstance().conf.get("face", "appid")
api_key = config.getInstance().conf.get("face", "key")
app_secret = config.getInstance().conf.get("face", "secret")
client = AipBodyAnalysis(app_id, api_key, app_secret)
with open(filename, 'rb') as fp:
img = fp.read()
result = client.bodyAnalysis(img)
if 'error_code' in result:
raise ValueError(result['error_msg'])
print('[+]Found person ' + str(result['person_num']))
# 中心点取鼻子x坐标
maxRight = 0
maxTop = 0
for person_info in result["person_info"]:
x = int(person_info['body_parts']['nose']['x'])
top = int(person_info['location']['top'])
if x > maxRight:
maxRight = x
maxTop = top
return maxRight,maxTop