1. Download and install opencv: opencv.orgdownloads.html. Note: Version 2.4.4 uses cmake. Therefore, you must install cmake in advance. Shell: wgetsoftlayer-dal.dl.sourceforge.netprojectopencvlibraryopencv-unix2.4.4OpenCV-2.4.4a.tar.bz2tarxvfO
1. Download and install opencv: http://opencv.org/downloads.html, and then install cmakeat. Shell: wget http://softlayer-dal.dl.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.4/OpenCV-2.4.4a.tar.bz2 tar xvf O
1. Download and install opencv
: Http://opencv.org/downloads.html, :2.4.4then, cmakeis enabled.
Shell:
Wget http://softlayer-dal.dl.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.4/OpenCV-2.4.4a.tar.bz2
Tar xvf OpenCV-2.4.4a.tar.bz2
Cd opencv-2.4.4/
Cmake ./
Make
Make install2. install facedetecthttp: // www.xarg.org/project/php-facedetect/
Cd PHP-Facedetect-master
/Usr/local/php/bin/phpize
./Configure -- with-php-config =/usr/local/php/bin/php-config
Make
Make install
Installing shared extensions:/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/
After compilation, the location of the facedetect. so file is displayed.
Finally, confirm to add in php. ini
Extension = facedetect. so, reload php-fpm.
3. Install imagemagickhttp: // www.imagemagick.org/script/install-source.php
Wget http://www.imagemagick.org/download/ImageMagick.tar.gz
Tar xvf ImageMagick.tar.gz
Cd ImageMagick-6.8.6-10/
./Configure
Make & make install
Ldconfig/usr/local/lib
4. Install the imagick extension http://pecl.php.net/package/imagick for php
Wget http://pecl.php.net/get/imagick-3.1.1.tgz
/Usr/local/php/bin/phpize
./Configure -- with-php-config =/usr/local/php/bin/php-config
Make
Make install
Installing shared extensions:/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/
Installing header files:/usr/local/php/include/php/
Finally, confirm to add in php. ini
Extension = imagick. so, reload php-fpm.
5. php instance code
Extract all xml files from the openCV source code/data/haarcascades/and put them in the php Execution directory. Here I put them in the data directory:
CropImage ($ v ['W'], $ v ['H'], $ v ['X'], $ v ['y']);} ob_clean (); header ("Content-Type: image/jpeg"); echo $ image; $ image-> destroy ();} else {?>
Reference URL:
Http://blog.csdn.net/zhongmao/article/details/3753377