php开发人脸识别的api接口

php开发人脸识别的api接口

ID:39467262

大小:61.50 KB

页数:4页

时间:2019-07-04

php开发人脸识别的api接口_第1页
php开发人脸识别的api接口_第2页
php开发人脸识别的api接口_第3页
php开发人脸识别的api接口_第4页
资源描述:

《php开发人脸识别的api接口》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、php开发人脸识别的api接口作者:  来源:互联网  日期:2013-11-1416:20:25 收藏  评论:( 0 )  阅读:1982在网上发现一个PHP编写的人脸识别的API,试了一下还不错,这里推荐给大家,有兴趣的可以研究研究。首先,检测出三张输入图片中的Face。然后,使用这三个Face各自创建1个新的Person。这三个Person将构建一个新的Group以作为候选的识别库。最后,输入一张新Image,并在已构建的Group中识别这个新Image中的Face。创建新的Person待识别图片首先需要经过初步检测,找出图片中F

2、ace的位置及属性。然后,再使用API中的Person管理创建新的Person。1234567891011121314151617181920//thelistofperson_nametotrainandidentifyfor$person_names = array("1", "2", "3");//storetheface_idsobtainedbydetection/detectAPI$face_ids = array();//registernewpeople,detectfacesforeach ($person_names 

3、as $person_name)    detect($api, $person_name, $face_ids);                              /* * createnewperson,detectfacesfromperson'simage_url */function detect(&$api, $person_name,&$face_ids){    //obtainphoto_urltotrain    $url =getTrainingUrl($person_name);             

4、                         //detectfacesinthisphoto    $result = $api->face_detect($url);    //skiperrors    if (empty($result->face))        return false;    //skipphotowithmultiplefaces(wearenotsurewhichfacetotrain)    if (count($result->face)>1)        return false;     

5、                                 //obtaintheface_id    $face_id = $result->face[0]->face_id;    $face_ids[]= $face_id;    //deletethepersonifexists212223242526272829303132333435    $api->person_delete($person_name);    //createanewpersonforthisface    $api->person_create(

6、$person_name);    //addfaceintonewperson    $api->person_add_face($face_id, $person_name);}构建新的Group注册一个新的Group,并将之前创建的Person加入这个Group。1234567891011//thenameofgroupfortesting$group = "sample_group";//generateanewgroup,addpeopleintogroupcreate_group($api, $group, $person_n

7、ames);                          /* * generateanewgroupwithgroup_name,addallpeopleintogroup */function create_group(&$api, $group_name, $person_names){12131415161718    //deletethegroupifexists    $api->group_delete($group_name);    //createnewgroup    $api->group_create($

8、group_name);    //addnewpersonintothegroup    foreach ($person_names as $person_name)        $ap

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。