阿里人脸识别API地址:
https://help.aliyun.com/knowledge_list/53366.html
你买了 就会有的东西
faceVerify
accessKeyId
accessKeySecret
faceVerifyRight 自定义配置为80
这个API说得太详细了 我贴一个短代码 匹配两个用户的相似程度 相似程序超过80就会返回true
public CommonResult face(String md5Openid,String imgurl) throws Exception {
//图片地址 可外网访问
String faceImg="";
String imgurl ="";
String body = "{\"type\": \"0\", \"image_url_1\":\""+faceImg+"\", \"content_1\":\"\", \"image_url_2\":\""+imgurl+"\", \"content_2\":\"\"}";
String rs= Face.sendPost(faceVerify, body, accessKeyId, accessKeySecret);
ObjectMapper om=new ObjectMapper();
PostFaceResult fs = om.readValue(rs, PostFaceResult.class);
System.out.println("response body:" + fs);
return new CommonResult().Success(fs.getConfidence()>faceVerifyRight);
}
同阿里一样需要付费获得SecretId和SecretKey 两个值
api测试地址
https://console.cloud.tencent.com/api/explorer?Product=iai&Version=2020-03-03&Action=CompareFace&SignVersion=
在这里插入图片描述
确实必填参数后直接复制右侧代码即可运行需注意图片格式
必填项中需注意图片需转换为base64格式
将本地/网络图片转换为base64格式
https://www.cnblogs.com/boris-et/p/10036511.html