OpenCV-for-PHP icon indicating copy to clipboard operation
OpenCV-for-PHP copied to clipboard

How to use this

Open nnnaik92 opened this issue 9 years ago • 14 comments

Can someone provide guide how to use this

nnnaik92 avatar Apr 20 '16 09:04 nnnaik92

echo "Install OpenCV dependencies" sudo apt-get install build-essential unzip sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev

echo "Install OpenCV from source" wget https://github.com/Itseez/opencv/archive/2.4.13.zip unzip opencv-2.4.13.zip cd ./opencv-2.4.13/ mkdir build cd ./build cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local .. sudo make -j7 sudo make install

echo "Enable PHP extension" sudo echo "extension=opencv.so" >> /etc/php5/mods-available/opencv.ini sudo ln -s /etc/php5/mods-available/opencv.ini /etc/php5/cli/conf.d/20-opencv.ini sudo ln -s /etc/php5/mods-available/opencv.ini /etc/php5/apache2/conf.d/20-opencv.ini

manti-by avatar Aug 16 '16 09:08 manti-by

Hello @manti-by Alexander, Should I include this in a .sh file and run ? Also I assume your system has the default LAMP package for Ubuntu and not XAMPP .. please confirm. Thanks in advance!

Regards Miltan

miltan avatar Aug 24 '16 08:08 miltan

Hi @miltan. You can simply paste this into shell or create sh script. Yes, I'm using Ubuntu 15.10 on my PC and Ubuntu 14.04 on Vagrant. In both cases these commands are working.

manti-by avatar Aug 24 '16 08:08 manti-by

Thanks a lot Alexander @manti-by , Really appreciate your prompt reply :+1:

miltan avatar Aug 24 '16 08:08 miltan

@miltan Here is my bootstrap script for Vagrant https://github.com/manti-by/m2/blob/manti-by-dev/bootstrap.sh.

manti-by avatar Aug 24 '16 08:08 manti-by

Thanks @manti-by , can you tell me if I can compare a list of facial images to find out a match using opencv ?

miltan avatar Aug 24 '16 09:08 miltan

@miltan Maybe yes, but for this purposes I'm using this library https://github.com/jenssegers/imagehash

manti-by avatar Aug 24 '16 11:08 manti-by

Hello @manti-by , i follow this installation but i can't use OpenCV in the examples

use OpenCV\Image as Image;
use OpenCV\Histogram as Histogram;

how can i get OpenCV dependencies please

mouradtritux avatar Dec 26 '16 15:12 mouradtritux

Hi @mouradtritux. Try to use this tutorial https://github.com/manti-by/m2/blob/manti-by-dev/bootstrap.sh#L22, should work on Ubuntu 14.04.

manti-by avatar Dec 27 '16 12:12 manti-by

Working example https://github.com/manti-by/m2/blob/manti-by-dev/app/includes/system.php#L599.

manti-by avatar Dec 27 '16 12:12 manti-by

thanks @manti-by

I have errors when i excute "make" command

/var/www/html/OpenCV-for-PHP$ make /bin/bash /var/www/html/OpenCV-for-PHP/libtool --mode=compile cc -I. -I/var/www/html/OpenCV-for-PHP -DPHP_ATOM_INC -I/var/www/html/OpenCV-for-PHP/include -I/var/www/html/OpenCV-for-PHP/main -I/var/www/html/OpenCV-for-PHP -I/usr/include/php/20151012 -I/usr/include/php/20151012/main -I/usr/include/php/20151012/TSRM -I/usr/include/php/20151012/Zend -I/usr/include/php/20151012/ext -I/usr/include/php/20151012/ext/date/lib -I/usr/local/include/opencv -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /var/www/html/OpenCV-for-PHP/opencv_error.c -o opencv_error.lo libtool: compile: cc -I. -I/var/www/html/OpenCV-for-PHP -DPHP_ATOM_INC -I/var/www/html/OpenCV-for-PHP/include -I/var/www/html/OpenCV-for-PHP/main -I/var/www/html/OpenCV-for-PHP -I/usr/include/php/20151012 -I/usr/include/php/20151012/main -I/usr/include/php/20151012/TSRM -I/usr/include/php/20151012/Zend -I/usr/include/php/20151012/ext -I/usr/include/php/20151012/ext/date/lib -I/usr/local/include/opencv -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /var/www/html/OpenCV-for-PHP/opencv_error.c -fPIC -DPIC -o .libs/opencv_error.o /var/www/html/OpenCV-for-PHP/opencv_error.c: In function 'zm_startup_opencv_error': /var/www/html/OpenCV-for-PHP/opencv_error.c:37:2: error: too many arguments to function 'zend_register_internal_class_ex' opencv_ce_cvexception = zend_register_internal_class_ex(&ce, zend_exception_get_default(TSRMLS_C), "Exception" TSRMLS_CC); ^ In file included from /usr/include/php/20151012/main/php.h:40:0, from /var/www/html/OpenCV-for-PHP/opencv_error.c:25: /usr/include/php/20151012/Zend/zend_API.h:290:28: note: declared here ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *class_entry, zend_class_entry *parent_ce); ^ make: *** [opencv_error.lo] Erreur 1

mouradtritux avatar Jan 02 '17 11:01 mouradtritux

Please show me guild install on mac os. Thanks

Tuan-T-Nguyen avatar May 15 '17 03:05 Tuan-T-Nguyen

@tomfriwel Try to check master branch

manti-by avatar Jun 29 '17 14:06 manti-by