论坛首页 综合技术论坛

如何使用人脸识别SDK为你的应用添加人脸识别功能

浏览 4658 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2014-05-01   最后修改:2014-05-01
这家提供高识别率的人脸识别SDK,支持所有常有编程语言,识别率很高。

复制网站上的介绍,有兴趣的童鞋可以试下:

在线人脸识别(OFaceR)是一个基于互联网的服务和软件,它通过一张选定的照片在人脸数据库中进行比较,从而实现从一张数字照片中自动识别或验证一个人。典型地,它被应用于各类安全系统中。

基于XML的人脸识别API使你更容易让你的应用具备人脸识别的能力,无论是对于可执行文件(exe),网站应用(web),移动应用或手机应用(mobile)等。我们的API支持所有常用的编程语言,包括但不限于:C/C++、PHP、ASP、Perl、Python、Javascript和Java,并且支持所有主要的操作系统,包括但不限于:Window、Linux、Mac OS、iOS和Android安卓。

这里有一个PHP脚本范例,它演示如何实现一个人脸照片比对的调用:

<?php
$fp = fopen ('test.jpg', 'rb');
if (!$fp)
{
  exit ('failed to open the picture file');
}

$photo = fread ($fp, filesize ('test.jpg'));
fclose ($fp);
if (!$photo)
{
  exit ('failed to read file');
}

$photo = base64_encode ($photo);

$cmd = '<OFR_Request>
<Action>recognise</Action>
<Session_id>438058746</Session_id>
<Database_id>100000519</Database_id>
<Result_num>5</Result_num>
<Photo>' . $photo . '</Photo>
</OFR_Request>';

$ch = curl_init ();
curl_setopt ($ch, CURLOPT_URL, 'http://api.ofacer.com/do.x');
curl_setopt ($ch, CURLOPT_POSTFIELDS, array('ofr' => $cmd));
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$a = curl_exec ($ch);
curl_close ($ch);
if (!$a)
{
  exit ('ofr service error');
}

$r_xml = simplexml_load_string ($a);
if (isset($r_xml->error) && (string)($r_xml->error))
{
  exit ((string)($r_xml->error));
}

$result_str = 'matching persons: '; $m_person_ids = array();
$m_rates = array();
foreach ($r_xml->match_persons->match_person as $match_person)
{
  $result_str .= (string)($match_person->person_id) . ' (' . (string)($match_person->rate)/10000.0 . '%), ';
}

echo $result_str;
?>


详细的SDK在线文档在这里:http://www.ofacer.com/documents.cn.html

论坛首页 综合技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics