标签:think timestamp bcf 文件 官方 top 私人 参数调用 .com
1.首先去百度申请人脸 APPID、 Apikey、 SecretKey
2.下载官方demo修改整合改名face文件夹或者加我私人qq 229435572 备注 人脸匹配,找我要face扩展类
3.把face 放在vendor下面
下面是一个简单的人脸年龄测试,具体可见官方文档,
public function faceCheck() {
Vendor(‘face.AipFace‘);
#后台申请的A K 和 S
$APPID = ‘去申请‘;
$Apikey = ‘去申请‘;
$SecretKey = ‘去申请‘;
$client = new \AipFace($APPID, $Apikey, $SecretKey);
$image = "http://www.vikily.com:8765/statics/Admin/img/test.jpg";
$imageType = "URL";
// 调用人脸检测
$client->detect($image, $imageType);
// 如果有可选参数
$options = array();
$options["face_field"] = "age";
$options["max_face_num"] = 2;
$options["face_type"] = "LIVE";
// 带参数调用人脸检测
$result = $client -> detect($image, $imageType, $options);
pf($result);
}
返回信息:
Array ( [error_code] => 0 [error_msg] => SUCCESS [log_id] => 5510199948905 [timestamp] => 1533286267 [cached] => 0 [result] => Array ( [face_num] => 1 [face_list] => Array ( [0] => Array ( [face_token] => 908ad0f2bcf04f27e0b41652d805af91 [location] => Array ( [left] => 212.8435516 [top] => 160.4919739 [width] => 304 [height] => 286 [rotation] => 4 ) [face_probability] => 1 [angle] => Array ( [yaw] => 1.442859173 [pitch] => 17.65565109 [roll] => 4.590346813 ) [age] => 23 ) ) ) )
标签:think timestamp bcf 文件 官方 top 私人 参数调用 .com
原文地址:https://www.cnblogs.com/leaf-cq/p/9415179.html