刷脸技术测试demo
技术来源:facecore
code 如下:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script src="jquery-1.8.2.min.js" type="text/javascript"></script>
<script src="jquery.faceRecognition.js"></script>
<meta content="application/xhtml+xml;charset=UTF-8" http-equiv="Content-Type">
<meta content="telephone=no, address=no" name="format-detection">
<script type="text/javascript">
$(function(){
var url1="http://p7.qhimg.com/t012aa1295d0ecbe26b.jpg";
var url2="http://npic7.edushi.com/cn/zixun/zh-chs/2015-09/06/8388-150Z6153447.png";
$.ajax({
url: 'http://api.facecore.cn/api/urlfacedetectandcompare?appkey=f8fbb3505421fa6f1c5250cc414de246',
type: 'POST',
data:{url1:url1,url2:url2},
dataType: 'json',
success: function (data) {
alert(data);
var similar = Math.round(data.similar * 10000) / 100+"%";
alert(similar);
},
error: function (msg) {
alert(msg);
}
}); }); </script> <link rel="shortcut icon" href="favicon.ico" /> </head> <body> <!-- 做对比的两张图片是:可以测试我和明星的相似度;--> <img src="http://p7.qhimg.com/t012aa1295d0ecbe26b.jpg" width="300" /> <img src="http://npic7.edushi.com/cn/zixun/zh-chs/2015-09/06/8388-150Z6153447.png" width="300" /> </body> </html>调用结果如下:
注意返回的是json数据。
The End!The End!The End!The End!The End!The End!The End!
本文转自许琴 51CTO博客,原文链接:http://blog.51cto.com/xuqin/1692177,如需转载请自行联系原作者