mgdm / OpenCV-for-PHP

An OpenCV binding for PHP
308 stars 95 forks source link

How to compile this extension? #1

Open benpptung opened 13 years ago

benpptung commented 13 years ago

Hi..thank you for this great extension. I'm trying to compile it, but failed.

I am using the following command :

phpize && ./configure && make && make install

and till end I got the following error message. ..... /usr/home/benpptung/OpenCV-for-PHP/opencv_image.c: In function 'zim_OpenCV_Image_haarDetectObjects': /usr/home/benpptung/OpenCV-for-PHP/opencv_image.c:766: error: too few arguments to function 'cvHaarDetectObjects'

I am using FreeBSD 8.2, and the OpenCV is 2.3.1, PHP is 5.3.8. Is there any document how to install the php extension? Any help would be appreciated.

mgdm commented 13 years ago

Hi, It looks like OpenCV 2.3 has changed the arguments to some of the functions. I'll see about getting it updated to handle that, and let you know.

Cheers Michael

benpptung commented 13 years ago

Hi...thank you for reply. I've tried to fix cvHaarDetectObjects parameter, but it seems there is not only this function, but also other function or constants, so I gave up eventually... ( ^_^" I am new to C), sorry cannot help.

antonvedeshin commented 13 years ago

Faced up with the same problem. I have just commented out this function, one function definition and one constant definition. Should work.

antonvedeshin commented 13 years ago

Michael, could you please fix this issue? Unfortunately I am not so familiar with open cv. Or at least please write down what and where approximately to fix, and we will fix it. Thank you in advance!

mgdm commented 13 years ago

I'll have a look when I get a spare minute - I want it to work with all the versions out there, so I'll need to do some version detection.

piolini commented 11 years ago

Hello,

I am trying to install this extension but I get this error

/var/www/multiDatabase_Project/libs/opencv.c: In function 'php_opencv_basedir_check': /var/www/multiDatabase_Project/libs/opencv.c:41:6: error: 'struct _php_core_globals' has no member named 'safe_mode' /var/www/multiDatabase_Project/libs/opencv.c:41:57: error: 'CHECKUID_CHECK_FILE_AND_DIR' undeclared (first use in this function) /var/www/multiDatabase_Project/libs/opencv.c:41:57: note: each undeclared identifier is reported only once for each function it appears in /var/www/multiDatabase_Project/libs/opencv.c:41:86: error: 'CHECKUID_NO_ERRORS' undeclared (first use in this function) /var/www/multiDatabase_Project/libs/opencv.c:44:9: warning: passing argument 1 of '_efree' discards 'const' qualifier from pointer target type [enabled by default] In file included from /usr/include/php5/Zend/zend.h:237:0, from /usr/include/php5/main/php.h:35, from /var/www/multiDatabase_Project/libs/opencv.c:25: /usr/include/php5/Zend/zendalloc.h:60:15: note: expected 'void ' but argument is of type 'const char ' /var/www/multiDatabase_Project/libs/opencv.c:51:9: warning: passing argument 1 of '_efree' discards 'const' qualifier from pointer target type [enabled by default] In file included from /usr/include/php5/Zend/zend.h:237:0, from /usr/include/php5/main/php.h:35, from /var/www/multiDatabase_Project/libs/opencv.c:25: /usr/include/php5/Zend/zend_alloc.h:60:15: note: expected 'void ' but argument is of type 'const char ' make: _* [opencv.lo] Error 1

I have PHP 5.4.6 and OpenCv 2.4.1

Can you help??

mgdm commented 11 years ago

I've not tested it on PHP 5.4 yet. I'll try and fix that and let you know when it's done.

On 07/12/12 13:46, piolini wrote:

Hello,

I am trying to install this extension but I get this error

/var/www/multiDatabase_Project/libs/opencv.c: In function 'php_opencv_basedir_check': /var/www/multiDatabase_Project/libs/opencv.c:41:6: error: 'struct _php_core_globals' has no member named 'safe_mode' /var/www/multiDatabase_Project/libs/opencv.c:41:57: error: 'CHECKUID_CHECK_FILE_AND_DIR' undeclared (first use in this function) /var/www/multiDatabase_Project/libs/opencv.c:41:57: note: each undeclared identifier is reported only once for each function it appears in /var/www/multiDatabase_Project/libs/opencv.c:41:86: error: 'CHECKUID_NO_ERRORS' undeclared (first use in this function) /var/www/multiDatabase_Project/libs/opencv.c:44:9: warning: passing argument 1 of '_efree' discards 'const' qualifier from pointer target type [enabled by default] In file included from /usr/include/php5/Zend/zend.h:237:0, from /usr/include/php5/main/php.h:35, from /var/www/multiDatabase_Project/libs/opencv.c:25: /usr/include/php5/Zend/zendalloc.h:60:15: note: expected 'void /' but argument is of type 'const char ' /var/www/multiDatabase_Project/libs/opencv.c:51:9: warning: passing argument 1 of '_efree' discards 'const' qualifier from pointer target type [enabled by default] In file included from /usr/include/php5/Zend/zend.h:237:0, from /usr/include/php5/main/php.h:35, from /var/www/multiDatabase_Project/libs/opencv.c:25: /usr/include/php5/Zend/zendalloc.h:60:15: note: expected 'void ' but argument is of type 'const char ' make: */ [opencv.lo] Error 1

I have PHP 5.4.6 and OpenCv 2.4.1

Can you help??

— Reply to this email directly or view it on GitHub https://github.com/mgdm/OpenCV-for-PHP/issues/1#issuecomment-11130348.

Cheers, Michael

piolini commented 11 years ago

Hello, Thank you very match!!I'll let you know if I will fix it Anna

Date: Sun, 9 Dec 2012 09:34:47 -0800 From: notifications@github.com To: OpenCV-for-PHP@noreply.github.com CC: anna_6022@hotmail.com Subject: Re: [OpenCV-for-PHP] How to compile this extension? (#1)

I've not tested it on PHP 5.4 yet. I'll try and fix that and let you

know when it's done.

On 07/12/12 13:46, piolini wrote:

Hello,

I am trying to install this extension but I get this error

/var/www/multiDatabase_Project/libs/opencv.c: In function

'php_opencv_basedir_check':

/var/www/multiDatabase_Project/libs/opencv.c:41:6: error: 'struct

_php_core_globals' has no member named 'safe_mode'

/var/www/multiDatabase_Project/libs/opencv.c:41:57: error:

'CHECKUID_CHECK_FILE_AND_DIR' undeclared (first use in this function)

/var/www/multiDatabase_Project/libs/opencv.c:41:57: note: each

undeclared identifier is reported only once for each function it

appears in

/var/www/multiDatabase_Project/libs/opencv.c:41:86: error:

'CHECKUID_NO_ERRORS' undeclared (first use in this function)

/var/www/multiDatabase_Project/libs/opencv.c:44:9: warning: passing

argument 1 of '_efree' discards 'const' qualifier from pointer target

type [enabled by default]

In file included from /usr/include/php5/Zend/zend.h:237:0,

from /usr/include/php5/main/php.h:35,

from /var/www/multiDatabase_Project/libs/opencv.c:25:

/usr/include/php5/Zend/zend_alloc.h:60:15: note: expected 'void /' but

argument is of type 'const char *'

/var/www/multiDatabase_Project/libs/opencv.c:51:9: warning: passing

argument 1 of '_efree' discards 'const' qualifier from pointer target

type [enabled by default]

In file included from /usr/include/php5/Zend/zend.h:237:0,

from /usr/include/php5/main/php.h:35,

from /var/www/multiDatabase_Project/libs/opencv.c:25:

/usr/include/php5/Zend/zend_alloc.h:60:15: note: expected 'void *' but

argument is of type 'const char *'

make: / [opencv.lo] Error 1

I have PHP 5.4.6 and OpenCv 2.4.1

Can you help??

Reply to this email directly or view it on GitHub

https://github.com/mgdm/OpenCV-for-PHP/issues/1#issuecomment-11130348.

Cheers,

Michael

          —

          Reply to this email directly or view it on GitHub.
drBenway commented 11 years ago

I get "duplicate symbol _opencv_original_error_handling in .libs/opencv_error.o and .libs/opencv.o for architecture x86_64 (macbook pro running mamp php 5.4.4.)

mgdm commented 11 years ago

I'll have a look at that tomorrow - I think I need to land the branch I've been working on. Thanks for the report!

Cheers, Michael

On Friday, 14 June 2013 at 15:42, yves peeters wrote:

I get "duplicate symbol _opencv_original_error_handling in .libs/opencv_error.o and .libs/opencv.o for architecture x86_64 (macbook pro running mamp php 5.4.4.)

— Reply to this email directly or view it on GitHub (https://github.com/mgdm/OpenCV-for-PHP/issues/1#issuecomment-19460905).

ghost commented 11 years ago

Hello hello...

I descovery the problem with the extension's installation using PHP 5.4 or 5.5.

edit the file opencv.c

and delete the lines 41, 42, 43, 44, 45 and 46.

ENJOY

waqaskhalid commented 10 years ago

Hi, i am getting following error,

Fatal error: Call to undefined function dl() in C:\xampp\htdocs\OpenCV\opencv.php on line 5

I am using PHP 5.4.7

Link to the description

http://stackoverflow.com/questions/21532741/call-to-undefined-function-dl-php

ekoneko commented 10 years ago

Hello, I'm getting some errors when "make", like this:

    error: too few arguments to function call, expected 3, have 2
    php_opencv_make_image_zval(temp, return_value);

I find the function in "php_opencv.h":

    PHP_OPENCV_API zval *php_opencv_make_image_zval(IplImage *image, zval *image_zval TSRMLS_DC);

It's just two arguments?


I sovled it... replace

    php_opencv_make_image_zval(temp, return_value)

to

    php_opencv_make_image_zval(temp, return_value TSRMLS_CC)

But I got another problem about version of libopencv :(

mgdm commented 10 years ago

I've not really had any time to work on this extension recently. I'm hoping to do so in the next couple of weeks so hopefully it'll work on recent OpenCV and PHP distributions.

gr0g commented 10 years ago

@mgdm nice work on the extension - how about you tell us more what's the list of things you'd like to be fixed/changed/improved so we can contribute. Thanks!

moho110 commented 10 years ago

hello when i install this extensions and i have a problem for OpenCV-for-PHP as following is: checking for opencv...not found configure:error:Ooops ! no opencv detected in the system.

prokopov-nikolai commented 9 years ago

Hello. When I do "make test", I have a warning

PHP Warning:  PHP Startup: Unable to load dynamic library '/home/kolya/www/disney.cinderella/opencv/modules/opencv.so' - /home/kolya/www/disney.cinderella/opencv/modules/opencv.so: undefined symbol: cvRelease in Unknown on line 0

_004 Can you help me? Before me is a challenge to compare the two images. Perhaps you know still some way how to do it, if you can not correct extension.

fernandohu commented 9 years ago

Hey, if you want to use OpenCV, just use C++, Ruby or Java. Actually, there is no port of OpenCV to PHP.

2015-01-16 4:57 GMT-02:00 Прокопов Николай notifications@github.com:

Hello. When I do "make test", I have a warning

PHP Warning: PHP Startup: Unable to load dynamic library '/home/kolya/www/disney.cinderella/opencv/modules/opencv.so' - /home/kolya/www/disney.cinderella/opencv/modules/opencv.so: undefined symbol: cvRelease in Unknown on line 0

[image: _004] https://cloud.githubusercontent.com/assets/1210038/5772558/a3cdda3e-9d65-11e4-9d40-22fc2cba05df.png Can you help me? Before me is a challenge to compare the two images. Perhaps you know still some way how to do it, if you can not correct extension.

— Reply to this email directly or view it on GitHub https://github.com/mgdm/OpenCV-for-PHP/issues/1#issuecomment-70215437.

Um abraço,

Fernando Hidemi Uchiyama www.fhu.com.br

prokopov-nikolai commented 9 years ago

Unfortunately I do not know these languages. Perhaps you know a way how to learn steper similarity of two images? I have a sticker and I need to find out whether he has to download photos.

fernandohu commented 9 years ago

I don't think I am the best person to give you tips of computer vision. Nevertheless, I didn't understand what you want to do. Can you give more details?

prokopov-nikolai commented 9 years ago

The file is an example of what needs to be done. https://yadi.sk/i/meOLgTFoe2n7L

fernandohu commented 9 years ago

I don't know if it helps, but you can try this page: http://www.intorobotics.com/how-to-detect-and-track-object-with-opencv/

It shows various ways of doing object recognition with OpenCV. Good luck with that, it is not a trivial task to do. And, if you are going the OpenCV way (it seems there is no other option), I recommend you forgetting PHP. No one has made a decent port to it (it is a so big library).

prokopov-nikolai commented 9 years ago

Thank you for your answers

popsompong commented 8 years ago
ghost commented 8 years ago

Dears,

I discovered a bug when to OpenCV 3.0.0....

Error: /home/wellton/Downloads/OpenCV-for-PHP-master/opencv_image.cpp:718:32: error: in C++98 'colour' must be initialized by constructor, not by '{...}' CvScalar colour = { 255, 0, 0 };

Solution: Open /home/wellton/Downloads/OpenCV-for-PHP-master/opencv_image.cpp Go to line 718. Change: CvScalar colour = { 255, 0, 0 }; TO: CvScalar colour = CvScalar();

=)

ENJOY... in the my fork is work.

mahethekiller commented 8 years ago

how to add this extention in php ini file , it still gives error PHP Fatal error: Class 'OpenCV\Image' not found in /root/opencv.php on line 9 please help , how to run

skizzo commented 8 years ago

I have the same error as @mahethekiller , please help with setting this up for XAMPP on Mac.

wonderaa commented 7 years ago

[root@localhost opencv]# phpize && ./configure --with-opencv=/opencv-2.4.13 && make && make install Configuring for: PHP Api Version: 20131106 Zend Module Api No: 20131226 Zend Extension Api No: 220131226 checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for a sed that does not truncate output... /usr/bin/sed checking for cc... cc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether cc accepts -g... yes checking for cc option to accept ISO C89... none needed checking how to run the C preprocessor... cc -E checking for icc... no checking for suncc... no checking whether cc understands -c and -o together... yes checking for system library directory... lib checking if compiler supports -R... no checking if compiler supports -Wl,-rpath,... yes checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu checking target system type... x86_64-unknown-linux-gnu checking for PHP prefix... /usr/local/php checking for PHP includes... -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib checking for PHP extension directory... /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226 checking for PHP installed headers prefix... /usr/local/php/include/php checking if debug is enabled... no checking if zts is enabled... no checking for re2c... no configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers. checking for gawk... gawk checking for OpenCV support... yes, shared checking PHP version... ok checking for g++... g++ checking whether we are using the GNU C++ compiler... yes checking whether g++ accepts -g... yes checking how to run the C++ preprocessor... g++ -E checking for pkg-config... found checking for opencv... not found configure: error: Ooops ! no opencv detected in the system

wonderaa commented 7 years ago

configure: error: Ooops ! no opencv detected in the system

kazuhiko-hotta commented 7 years ago

try this

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/
./configure