运行不了 不知哪有错
楼主200斤 发布于2019-04 浏览:1456 回复:1
0
收藏

# encoding:utf-8
import json
import urllib.request
import base64
'''
人脸搜索
'''

with open("E:\Face_piture\\image1.jpg", 'rb') as f:
base64_data = base64.b64encode(f.read())
codee = base64_data.decode()

params_d = dict()
params_d['image'] = str(codee, encoding='utf-8')
params_d['image_type'] = 'BASE64'
params = json.dumps(params_d).encode('utf-8')

request_url = "https://aip.baidubce.com/rest/2.0/face/v3/search"
params = "{\"image\":\"params\",\"image_type\":\"BASE64\",\"group_id_list\":\"gropu001\",\"quality_control\":\"LOW\"}"
access_token = '已填入'
request_url = request_url + "?access_token=" + access_token
request = urllib.request.Request(url=request_url, data=params.encode(encoding='UTF8'))
request.add_header('Content-Type', 'application/json')
response = urllib.request.urlopen(request)
content = response.read()
if content:
print (content)

收藏
点赞
0
个赞
共1条回复 最后由liguanghui2588回复于2019-04
#2liguanghui2588回复于2019-04

这是在人脸识别

0
TOP
切换版块