- 1、本文档共4页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
php开发人脸识别的api接口
php开发人脸识别的api接口
作者: 来源:互联网 日期:2013-11-14 16:20:25?收藏 评论:(?0?) 阅读:1982
在网上发现一个PHP编写的人脸识别的API,试了一下还不错,这里推荐给大家,有兴趣的可以研究研究。首先,检测出三张输入图片中的Face。然后,使用这三个Face各自创建1个新的Person。这三个Person将构建一个新的Group以作为候选的识别库。最后,输入一张新Image,并在已构建的Group中识别这个新Image中的Face。
创建新的Person
待识别图片首先需要经过初步检测,找出图片中Face的位置及属性。然后,再使用API中的Person管理创建新的Person。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35 // the list of person_name to train and identify for
$person_names?=?array(1,?2,?3);
// store the face_ids obtained by detection/detect API
$face_ids?=?array();
// register new people, detect faces
foreach?($person_names?as?$person_name)
????detect($api,?$person_name,?$face_ids);
??????????????????????????????
/*
?*? create new person, detect faces from persons image_url
?*/
function?detect($api,?$person_name, $face_ids)
{
????// obtain photo_url to train
????$url?= getTrainingUrl($person_name);
??????????????????????????????????
????// detect faces in this photo
????$result?=?$api-face_detect($url);
????// skip errors
????if?(empty($result-face))
????????return?false;
????// skip photo with multiple faces (we are not sure which face to train)
????if?(count($result-face) 1)
????????return?false;
??????????????????????????????????
????// obtain the face_id
????$face_id?=?$result-face[0]-face_id;
????$face_ids[] =?$face_id;
????// delete the person if exists
????$api-person_delete($person_name);
????// create a new person for this face
????$api-person_create($person_name);
????// add face into new person
????$api-person_add_face($face_id,?$person_name);
} 构建新的Group
注册一个新的Group,并将之前创建的Person加入这个Group。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 // the name of group for testing
$group?=?sample_group;
// generate a new group, add people into group
create_group($api,?$group,?$person_names);
??????????????????????????
/*
?*? generate a new group with group_name, add all people into group
?*/
function?create_group($api,?$group_name,?$person_names)
{
????// delete
您可能关注的文档
- 建筑环境与能源应用工程学科导论论文.docx
- 家族企业的传承问题.doc
- 柴油发电机组的使用、日常维护及保养.doc
- 家族企业的内伤.doc
- 无线遥控门铃电工电子实习总结报告.doc
- 大学生对职业生涯规划的调研报告.docx
- 16、歌舞类娱乐.doc
- 科学组研修纪实.doc
- 煤矿安全生产标准化基本要求及评分方法(试行)2017.doc
- 2016中考王中考命题研究思想化学专题五实验方案的设计与评价.docx
- 5.3.1函数的单调性(教学课件)--高中数学人教A版(2019)选择性必修第二册.pptx
- 部编版道德与法治2024三年级上册 《科技提升国力》PPT课件.pptx
- 2.7.2 抛物线的几何性质(教学课件)-高中数学人教B版(2019)选择性必修第一册.pptx
- 人教部编统编版小学六年级上册道德与法治9 知法守法 依法维权(第一课时)课件.pptx
- 三年级上册品德道德与法治《学习伴我成长》.pptx
- 部编版小学道德与法治六年级上册6 人大代表为人民 课件.pptx
- 部编版小学道德与法治六年级上册1感受生活中的法律第一课时课件.pptx
- 2.5.2圆与圆的位置关系(教学课件)-高中数学人教A版(2019)选择性必修第一册.pptx
- 2.5.1直线与圆的位置关系-(教学课件)--高中数学人教A版(2019)选择性必修第一册.pptx
- 14.1.1 同底数幂的乘法(教学课件)-初中数学人教版八年级上册.pptx
文档评论(0)