PHP Face Recognition Using OpenCV

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.