I'm trying to install OpenCV for PHP but it doesn't work.
https://github.com/mgdm/OpenCV-for-PHP
I did the following
installed OpenCV
$ sudo aptitude install libcv2.1
tried to install opencv for php
$ sudo phpize && ./configure && make && make install
tried to uses it and I got an error
$ php examples/test_convert.php
php: symbol lookup error: /usr/lib/php5/20090626/opencv.so: undefined symbol: cvSetErrMode
I thought the OpenCV for PHP needs the OpenCV libs address,
$ ldd /usr/lib/php5/20090626/opencv.so
linux-vdso.so.1 => (0x00007fff45de2000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fd2d74c3000)
/lib64/ld-linux-x86-64.so.2 (0x00007fd2d7a8a000)
so I tried this
$ phpize
$ ./configure
edit Makefile
< OPENCV_SHARED_LIBADD =
> OPENCV_SHARED_LIBADD = /usr/lib/libcv.so.2.1
$ make
$ sudo make install
and it still doesnt work.
I'm using Ubuntu11.04.
Do you have any idea?
http://www.xarg.org/project/php-facedetect/ is a very good tutorial to install OpenCV on linux machine, if you know a little about PHP & Apache Web Server this tutorial will help you a lot
Regrads
Umair Iqbal
- You can try this https://github.com/hihozhou/php-opencv
- Supporting the latest php7+ and opencv3.3+
- Doc:http://phpopencv.org/docs
- In addition to the basic image processing, it also implements face detection and face recognition
e.g:
use CV\Face\LBPHFaceRecognizer;
//use ...;
$src = imread('facePic.jpg');
$gray = cvtColor($src, COLOR_BGR2GRAY);
equalizeHist($gray, $gray);
$faceRecognizer = LBPHFaceRecognizer::create();
/* ... */ //get $images and $labels for train
$faceRecognizer->train($images, $labels);//How to get $image and $labels, see the document
/* ... */ //Face detection using CascadeClassifier
$faceLabel = $faceRecognizer->predict($gray);
/* ... */ //draw face and name
If someone needs I've improved a bit the library:
https://github.com/ProGM/OpenCV-for-PHP
I fixed compilation for php5.4 and added a solution for your issue. Follow the installation guide:
https://github.com/ProGM/OpenCV-for-PHP/wiki/Installation-guide
Regards.