|
他写了一个PHP扩展openCV,只封装了两个函数,叫face_detect和face_count。openCV是一个开源的用C/C++开 发的计算机图形图像库,非常强大,研究资料很齐全。本文重点是介绍如何使用php来调用其中的局部的功能。人脸侦查技术只是openCV一个应用分支。 1.安装 1.1.安装 OpenCV (OpenCV 1.0.0) #tar xvzf OpenCV-1.0.0.tar.gz
#cd opencv-1.0.0 #./configure #make #make install #make check (检查是否安装全部正确) 提示: 不要指定安装路径,否则后面编译facedetect会找不到OpenCV的路径。 1.2 安装facedetect #tar xzvf facedetect-1.0.0.tar.gz
#cd facedetect-1.0.0 #phpize && ./configure && make && make install 编译完之后会提示facedetect.so 文件所在的位置。 最后确认在php.ini加入 2.函数使用 //检查有多少个脸型
var_dump(face_count(’party.jpeg’, haarcascade_frontalface_alt.xml’)); //返回脸型在图片中的位置参数,多个则返回数组 3.应用 <?php
if($_FILES){ $img = $_FILES['pic']['tmp_name']; //$arr1 = face_detect($img, ‘haarcascade_frontalface_alt_tree.xml’); if(is_array($arr1)) $all =array_merge($arr,$arr1); $im = new Imagick($img); header( “Content-Type: image/png” ); 参考资料: http://www.xarg.org/2008/07/face-detection-with-php/ http://www.opencv.org.cn/index.php/首页 http://www.cs.iit.edu/~agam/cs512/lect-notes/opencv-intro/index.html |
|
引用地址:http://7yes.com/blog/article/id/220/
评论:0 , 点击:391 , 2008-11-12 15:09
http://7yes.com/blog/article/id/220/
