参考资料
流程如下图
背景知识
php调用exe的返回
在线人脸检测
目录结构
│ face-detect.exe│ haarcascade_frontalface_alt.xml│ shutter.mp3│ test.html│ test.php│ testphp.php│ webcam.js│ webcam.swf│ └─out
test.html
JPEGCam Test Page
JPEGCam Test PageDemonstrates a very simple, one-click capture & upload implementation |
test.php
$line) { if (preg_match('/\d+,\s*([^\s]+)\s+\((\d+)x(\d+)\)/i', $line, $m)) { // print 'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['REQUEST_URI'])."/".$m[1]; // echo ""; // echo $m[2]; // echo $m[3]; } }$url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['REQUEST_URI']) . '/' . $filename;print "$url\n";
实验结果
out目录里就有检测的脸了
source code download
修改人脸检测自带的php文件
true); foreach ($out as $i => $line) { if (preg_match('/\d+,\s*([^\s]+)\s+\((\d+)x(\d+)\)/i', $line, $m)) $res['images'][] = array('src' => $m[1], 'width' => $m[2], 'height' => $m[3]); } } else $res = array('success' => false, 'msg' => $last); header('Content-Type: application/json'); echo json_encode($res);
效果