小编有一个学习交流圈688244617 ,有免费资料和大量干货,欢迎来一起交流。
import requests
import simplejson
import json
import base64
def find_face(imgpath):
print("finding")
http_url = 'https://api-cn.faceplusplus.com/facepp/v3/detect'
data = {"api_key": "https://console.faceplusplus.com.cn申请'',
"api_secret": 'https://console.faceplusplus.com.cn申请', "image_url": imgpath, "return_landmark": 1}
files = {"image_file": open(imgpath, "rb")}
response = requests.post(http_url, data=data, files=files)
req_con = response.content.decode('utf-8')
req_dict = json.JSONDecoder().decode(req_con)
this_json = simplejson.dumps(req_dict)
this_json2 = simplejson.loads(this_json)
faces = this_json2['faces']
list0 = faces[0]
rectangle = list0['face_rectangle']
# print(rectangle)
return rectangle
# number表示换脸的相似度
def merge_face(image_url_1, image_url_2, image_url, number):
ff1 = find_face(image_url_1)
ff2 = find_
AI换脸技术源码
最新推荐文章于 2025-07-15 12:36:54 发布
