A simple OpenCV wrapper for PHP to detect faces on images
OpenCV 3 Support
See Details
A simple OpenCV wrapper for PHP to detect faces on images
Home Page: http://www.xarg.org/project/php-facedetect/
License: BSD 3-Clause "New" or "Revised" License
A simple OpenCV wrapper for PHP to detect faces on images
OpenCV 3 Support
See Details
I am pleased to announce that this extension is now compiled for Windows by the PHP Extension Repository site.
You can download the DLLs on the extension page: https://phpext.phptools.online/extension/system/facedetect-428
If you have any questions, I am available to discuss them.
Hello,
I try to install PHP-Facedetect on my Mac (OSX 10.11.1) but it fails.
I did install opencv3 using homebrew :
$ brew install opencv3 --with-contrib
$ brew link opencv3
Then tried to build the PHP-Facedetect extension
$ phpize && ./configure && make && make install
Configuring for:
PHP Api Version: 20131106
Zend Module Api No: 20131226
Zend Extension Api No: 220131226
cp: /Users/loranger/Developer/projects/automask/public/PHP-Facedetect/build/mkdep.awk: Permission denied
cp: /Users/loranger/Developer/projects/automask/public/PHP-Facedetect/build/scan_makefile_in.awk: Permission denied
cp: /Users/loranger/Developer/projects/automask/public/PHP-Facedetect/build/shtool: Permission denied
cp: /Users/loranger/Developer/projects/automask/public/PHP-Facedetect/build/libtool.m4: Permission denied
cp: /Users/loranger/Developer/projects/automask/public/PHP-Facedetect/acinclude.m4: Permission denied
cp: /Users/loranger/Developer/projects/automask/public/PHP-Facedetect/Makefile.global: Permission denied
cp: /Users/loranger/Developer/projects/automask/public/PHP-Facedetect/config.sub: Permission denied
cp: /Users/loranger/Developer/projects/automask/public/PHP-Facedetect/config.guess: Permission denied
cp: /Users/loranger/Developer/projects/automask/public/PHP-Facedetect/ltmain.sh: Permission denied
cp: /Users/loranger/Developer/projects/automask/public/PHP-Facedetect/run-tests.php: Permission denied
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/local/bin/gsed
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-apple-darwin15.0.0
checking host system type... x86_64-apple-darwin15.0.0
checking target system type... x86_64-apple-darwin15.0.0
checking for PHP prefix... /usr/local/Cellar/php56/5.6.15
checking for PHP includes... -I/usr/local/Cellar/php56/5.6.15/include/php -I/usr/local/Cellar/php56/5.6.15/include/php/main -I/usr/local/Cellar/php56/5.6.15/include/php/TSRM -I/usr/local/Cellar/php56/5.6.15/include/php/Zend -I/usr/local/Cellar/php56/5.6.15/include/php/ext -I/usr/local/Cellar/php56/5.6.15/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/Cellar/php56/5.6.15/lib/php/extensions/no-debug-non-zts-20131226
checking for PHP installed headers prefix... /usr/local/Cellar/php56/5.6.15/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 facedetect support... yes, shared
checking for facedetect in default path... found in /usr/local
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking /usr/local/include/opencv/cv.h usability... yes
checking /usr/local/include/opencv/cv.h presence... yes
checking for /usr/local/include/opencv/cv.h... yes
checking /usr/local/include/opencv/highgui.h usability... yes
checking /usr/local/include/opencv/highgui.h presence... yes
checking for /usr/local/include/opencv/highgui.h... yes
checking for cvLoad in -lopencv_core... yes
checking for cvHaarDetectObjects in -lopencv_objdetect... yes
./configure: line 4785: ,: command not found
checking for ld used by cc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 196608
checking command to parse /usr/bin/nm output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking if cc supports -fno-rtti -fno-exceptions... yes
checking for cc option to produce PIC... -fno-common
checking if cc PIC flag -fno-common works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin15.0.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
config.status: config.h is unchanged
/bin/sh /Users/loranger/Developer/projects/automask/public/PHP-Facedetect/libtool --mode=compile cc -I. -I/Users/loranger/Developer/projects/automask/public/PHP-Facedetect -DPHP_ATOM_INC -I/Users/loranger/Developer/projects/automask/public/PHP-Facedetect/include -I/Users/loranger/Developer/projects/automask/public/PHP-Facedetect/main -I/Users/loranger/Developer/projects/automask/public/PHP-Facedetect -I/usr/local/Cellar/php56/5.6.15/include/php -I/usr/local/Cellar/php56/5.6.15/include/php/main -I/usr/local/Cellar/php56/5.6.15/include/php/TSRM -I/usr/local/Cellar/php56/5.6.15/include/php/Zend -I/usr/local/Cellar/php56/5.6.15/include/php/ext -I/usr/local/Cellar/php56/5.6.15/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /Users/loranger/Developer/projects/automask/public/PHP-Facedetect/facedetect.c -o facedetect.lo
mkdir .libs
cc -I. -I/Users/loranger/Developer/projects/automask/public/PHP-Facedetect -DPHP_ATOM_INC -I/Users/loranger/Developer/projects/automask/public/PHP-Facedetect/include -I/Users/loranger/Developer/projects/automask/public/PHP-Facedetect/main -I/Users/loranger/Developer/projects/automask/public/PHP-Facedetect -I/usr/local/Cellar/php56/5.6.15/include/php -I/usr/local/Cellar/php56/5.6.15/include/php/main -I/usr/local/Cellar/php56/5.6.15/include/php/TSRM -I/usr/local/Cellar/php56/5.6.15/include/php/Zend -I/usr/local/Cellar/php56/5.6.15/include/php/ext -I/usr/local/Cellar/php56/5.6.15/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /Users/loranger/Developer/projects/automask/public/PHP-Facedetect/facedetect.c -fno-common -DPIC -o .libs/facedetect.o
/Users/loranger/Developer/projects/automask/public/PHP-Facedetect/facedetect.c:69:48: error: use of
undeclared identifier 'CV_VERSION'; did you mean 'CV_MEDIAN'?
php_info_print_table_row(2, "OpenCV version", CV_VERSION);
^~~~~~~~~~
CV_MEDIAN
/usr/local/include/opencv2/imgproc/types_c.h:80:5: note: 'CV_MEDIAN' declared here
CV_MEDIAN =3,
^
1 error generated.
make: *** [facedetect.lo] Error 1
Did I miss something important ?
Do you have any clue for me ?
Thanks
could you please tag and version your extension. i'm trying to package it into distribution
i.e git tag and push it to github, so tagged release tarballs could be downloaded
Package is not available .... ? tnx
Hi,
after some couple of hours I managed to install everything on my Debian Wheezy.
But I receive following error, no matter which cascade I'm trying to load
OpenCV Error: Unspecified error (The node does not represent a user object (unknown type?)) in cvRead, file /root/opencv-2.4.9/modules/core/src/persistence.cpp, line 4991
terminate called after throwing an instance of 'cv::Exception'
what(): /root/opencv-2.4.9/modules/core/src/persistence.cpp:4991: error: (-2) The node does not represent a user object (unknown type?) in function cvRead
Do you have any idea whats going on? There are hundreds of poeple with this issue but only workarounds for java - not php. Any idea? PHP 5.4 on Debian Wheezy, (fgci)
Hi,
i have installed all like you wrote and the facedetect class is also in my php.ini but if I want to try it with
var_dump(face_count('1_1.jpeg', 'haarcascade_frontalface_alt.xml'));
var_dump(face_detect('1_1.jpeg', 'haarcascade_frontalface_alt.xml'));
I only see bool(false) bool(false) nothing else. I have tried it with several pictures.
I don't know where mistake is.
PHP.ini shows:
facedetect
facedetect support enabled
facedetect version 1.1.0
OpenCV version 2.4.3
php5
I got this bug report [1] from Fedora 23, I try update to php-facedetect-1.1.0 and still verify that http
shutdown just stop after timeout , instead be quickly.
i have the problem that "haarcascade_profileface" runs sometimes very long...
is there a way to limit the execution time of a call?
It would be nice to have a face recognition feature after face detection so we can compare faces between images (detect / train / recognize).
I had installed the latest version from the repository
but yet when i run ./configure i get this error
checking /usr/local/include/opencv/cv.h usability... yes
checking /usr/local/include/opencv/cv.h presence... yes
checking for /usr/local/include/opencv/cv.h... yes
checking /usr/local/include/opencv/highgui.h usability... yes
checking /usr/local/include/opencv/highgui.h presence... yes
checking for /usr/local/include/opencv/highgui.h... yes
checking for cvLoad in -lopencv_objdetect... no
configure: error: wrong OpenCV version or OpenCV not found
Any solutions?
They say OpenCV 3 has great improvements regarding face recognition. It would be great to see how it works with OpenCV 3.
怎么实现证件照制作功能
hi,
i have install the latest version of OpenCV but i cant complete ./configure ...
checking /usr/include/opencv/cv.h usability... yes
checking /usr/include/opencv/cv.h presence... yes
checking for /usr/include/opencv/cv.h... yes
checking /usr/include/opencv/highgui.h usability... yes
checking /usr/include/opencv/highgui.h presence... yes
checking for /usr/include/opencv/highgui.h... yes
checking for cvLoad in -lopencv_objdetect... no
configure: error: wrong OpenCV version or OpenCV not found
root@severnaya> ls -l /usr/lib | grep opencv_objdetect 2
lrwxrwxrwx 1 root root 26 Dec 20 20:14 libopencv_objdetect.so -> libopencv_objdetect.so.2.3
lrwxrwxrwx 1 root root 28 Dec 20 20:14 libopencv_objdetect.so.2.3 -> libopencv_objdetect.so.2.3.1
-rwxr-xr-x 1 root root 366K Dec 20 20:14 libopencv_objdetect.so.2.3.1
phpize && ./configure && make && make install
Ubuntu 16.04 / PHP 7.2 / Python 2.7.12 / OpenCV 3.4.0
Configuring for:
PHP Api Version: 20170718
Zend Module Api No: 20170718
Zend Extension Api No: 320170718
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /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-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php/20170718 -I/usr/include/php/20170718/main -I/usr/include/php/20170718/TSRM -I/usr/include/php/20170718/Zend -I/usr/include/php/20170718/ext -I/usr/include/php/20170718/ext/date/lib
checking for PHP extension directory... /usr/lib/php/20170718
checking for PHP installed headers prefix... /usr/include/php/20170718
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... re2c
checking for re2c version... 0.16 (ok)
checking for gawk... gawk
checking for facedetect support... yes, shared
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... no
checking for opencv... configure: error: Please reinstall opencv
After installation when i have include facedetect.so into php.ini and reboot php-fpm:
Starting php_fpm.
Segmentation fault (core dumped)
/usr/local/etc/rc.d/php-fpm: WARNING: failed to start php_fpm
Hello,
I'm currently running CentOS 7, OpenCV 3.4.3, and PHP 7.2 (remi). configure goes through no issues but it fails to build the module. Any suggestions?
[root@raiden PHP-Facedetect]# ./configure --with-php-config=/opt/remi/php72/root/usr/bin/php-config
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... /opt/remi/php72/root/usr
checking for PHP includes... -I/opt/remi/php72/root/usr/include/php -I/opt/remi/php72/root/usr/include/php/main -I/opt/remi/php72/root/usr/include/php/TSRM -I/opt/remi/php72/root/usr/include/php/Zend -I/opt/remi/php72/root/usr/include/php/ext -I/opt/remi/php72/root/usr/include/php/ext/date/lib
checking for PHP extension directory... /opt/remi/php72/root/usr/lib64/php/modules
checking for PHP installed headers prefix... /opt/remi/php72/root/usr/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 facedetect support... yes, shared
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... /usr/bin/pkg-config
checking for opencv... 3.4.3
checking how to print strings... printf
checking for a sed that does not truncate output... (cached) /usr/bin/sed
checking for fgrep... /usr/bin/grep -F
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking for gawk... (cached) gawk
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for sysroot... no
checking for mt... no
checking if : is a manifest tool... no
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /usr/bin/ld -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... no
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
configure: creating ./config.status
config.status: creating config.h
config.status: executing libtool commands
[root@raiden PHP-Facedetect]# make
/bin/sh /usr/local/src/PHP-Facedetect/libtool --mode=compile g++ -I. -I/usr/local/src/PHP-Facedetect -DPHP_ATOM_INC -I/usr/local/src/PHP-Facedetect/include -I/usr/local/src/PHP-Facedetect/main -I/usr/local/src/PHP-Facedetect -I/opt/remi/php72/root/usr/include/php -I/opt/remi/php72/root/usr/include/php/main -I/opt/remi/php72/root/usr/include/php/TSRM -I/opt/remi/php72/root/usr/include/php/Zend -I/opt/remi/php72/root/usr/include/php/ext -I/opt/remi/php72/root/usr/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/PHP-Facedetect/facedetect.cc -o facedetect.lo
libtool: compile: g++ -I. -I/usr/local/src/PHP-Facedetect -DPHP_ATOM_INC -I/usr/local/src/PHP-Facedetect/include -I/usr/local/src/PHP-Facedetect/main -I/usr/local/src/PHP-Facedetect -I/opt/remi/php72/root/usr/include/php -I/opt/remi/php72/root/usr/include/php/main -I/opt/remi/php72/root/usr/include/php/TSRM -I/opt/remi/php72/root/usr/include/php/Zend -I/opt/remi/php72/root/usr/include/php/ext -I/opt/remi/php72/root/usr/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/PHP-Facedetect/facedetect.cc -fPIC -DPIC -o .libs/facedetect.o
In file included from /opt/remi/php72/root/usr/include/php/Zend/zend_types.h:27:0,
from /opt/remi/php72/root/usr/include/php/Zend/zend.h:29,
from /opt/remi/php72/root/usr/include/php/main/php.h:35,
from /usr/local/src/PHP-Facedetect/facedetect.cc:24:
/opt/remi/php72/root/usr/include/php/Zend/zend_operators.h: In function 'void fast_long_increment_function(zval*)':
/opt/remi/php72/root/usr/include/php/Zend/zend_operators.h:446:68: error: '__builtin_saddl_overflow' was not declared in this scope
if (UNEXPECTED(__builtin_saddl_overflow(Z_LVAL_P(op1), 1, &lresult))) {
^
/opt/remi/php72/root/usr/include/php/Zend/zend_portability.h:312:52: note: in definition of macro 'UNEXPECTED'
# define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)
^
/opt/remi/php72/root/usr/include/php/Zend/zend_operators.h: In function 'void fast_long_decrement_function(zval*)':
/opt/remi/php72/root/usr/include/php/Zend/zend_operators.h:500:68: error: '__builtin_ssubl_overflow' was not declared in this scope
if (UNEXPECTED(__builtin_ssubl_overflow(Z_LVAL_P(op1), 1, &lresult))) {
^
/opt/remi/php72/root/usr/include/php/Zend/zend_portability.h:312:52: note: in definition of macro 'UNEXPECTED'
# define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)
^
/opt/remi/php72/root/usr/include/php/Zend/zend_operators.h: In function 'void fast_long_add_function(zval*, zval*, zval*)':
/opt/remi/php72/root/usr/include/php/Zend/zend_operators.h:554:80: error: '__builtin_saddl_overflow' was not declared in this scope
if (UNEXPECTED(__builtin_saddl_overflow(Z_LVAL_P(op1), Z_LVAL_P(op2), &lresult))) {
^
/opt/remi/php72/root/usr/include/php/Zend/zend_portability.h:312:52: note: in definition of macro 'UNEXPECTED'
# define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)
^
/opt/remi/php72/root/usr/include/php/Zend/zend_operators.h: In function 'void fast_long_sub_function(zval*, zval*, zval*)':
/opt/remi/php72/root/usr/include/php/Zend/zend_operators.h:657:80: error: '__builtin_ssubl_overflow' was not declared in this scope
if (UNEXPECTED(__builtin_ssubl_overflow(Z_LVAL_P(op1), Z_LVAL_P(op2), &lresult))) {
^
/opt/remi/php72/root/usr/include/php/Zend/zend_portability.h:312:52: note: in definition of macro 'UNEXPECTED'
# define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)
^
make: *** [facedetect.lo] Error 1
[root@raiden PHP-Facedetect]#
OpenCV Error: Unspecified error (The node does not represent a user object (unknown type?)) in cvRead, file /home/work/env/cv/opencv/modules/core/src/persistence.cpp, line 4976
terminate called after throwing an instance of 'cv::Exception'
what(): /home/work/env/cv/opencv/modules/core/src/persistence.cpp:4976: error: (-2) The node does not represent a user object (unknown type?) in function cvRead
Magick: abort due to signal 6 (SIGABRT) "Abort"...
Aborted
test code: $detect_result = face_detect('./lena512color.jpg', './haarcascade_frontalcatface_extended.xml'); var_dump($detect_result);
Whenever I try to restart apache now I get the following error:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20131226/facedetect.so' - /usr/lib/php5/20131226/facedetect.so: undefined symbol: cvLoadImage in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20131226/facedetect.so' - /usr/lib/php5/20131226/facedetect.so: undefined symbol: cvLoadImage in Unknown on line 0
AH00163: Apache/2.4.18 (Ubuntu) OpenSSL/1.0.2e configured -- resuming normal operations
An ofcourse it won't work since it wasn't loaded !! Any clue what went wrong ?
PHP Version 5.6.17
OpenCV Verison 3.1.0
Hello,
I was able to compile this extension for PHP 7 using opencv3 on osx and debian jessie.
I had to
wget https://github.com/Itseez/opencv/raw/master/modules/objdetect/include/opencv2/objdetect/objdetect_c.h -O /usr/local/include/opencv2/objdetect/objdetect_c.h
in order to pass the ./configure
step, and then the facedetect.so compiled, but I cannot use it :
As soon as I try to face_detect
I get this fatal error :
symbol lookup error: /usr/lib/php/20151012/facedetect.so: undefined symbol: MAKE_STD_ZVAL
Is this a “normal” bug related to PHP7 and PHP-Facdetect ?
i have install the 2.4.5-3.e17 of OpenCV and 2.4.5-3.e17 of OpenCV-devel but i cant complete ./configure ...
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking /usr/include/opencv2/core/core_c.h usability... yes
checking /usr/include/opencv2/core/core_c.h presence... yes
checking for /usr/include/opencv2/core/core_c.h... yes
checking /usr/include/opencv2/imgproc/imgproc_c.h usability... yes
checking /usr/include/opencv2/imgproc/imgproc_c.h presence... yes
checking for /usr/include/opencv2/imgproc/imgproc_c.h... yes
checking /usr/include/opencv2/photo/photo_c.h usability... yes
checking /usr/include/opencv2/photo/photo_c.h presence... yes
checking for /usr/include/opencv2/photo/photo_c.h... yes
checking /usr/include/opencv2/objdetect/objdetect_c.h usability... no
checking /usr/include/opencv2/objdetect/objdetect_c.h presence... no
checking for /usr/include/opencv2/objdetect/objdetect_c.h... no
configure: error: 'opencv/objdetect/objdetect_c.h' header not found
I use centos7
I had installed the latest version from the repository
but yet when i run ./configure i get this error
checking /usr/local/include/opencv/cv.h usability... yes
checking /usr/local/include/opencv/cv.h presence... yes
checking for /usr/local/include/opencv/cv.h... yes
checking /usr/local/include/opencv/highgui.h usability... yes
checking /usr/local/include/opencv/highgui.h presence... yes
checking for /usr/local/include/opencv/highgui.h... yes
checking for cvLoad in -lopencv_objdetect... no
configure: error: wrong OpenCV version or OpenCV not found
Any solutions?
Current license is "PHP". This license can't be used by anything but PHP itself.
Can you change the license to something else (Expat is a good candidate, or BSD-2-clause)?
While you're at it, can you also add the license file?
Regards
More info:
Line 24 in 9eefabd
Giving a list of zend errors.
from /home/vagrant/PHP-Facedetect/facedetect.cc:24:
/usr/include/php/Zend/zend_operators.h: In function 'void fast_long_increment_function(zval*)':
/usr/include/php/Zend/zend_operators.h:446:68: error: '__builtin_saddl_overflow' was not declared in this scope
if (UNEXPECTED(__builtin_saddl_overflow(Z_LVAL_P(op1), 1, &lresult))) {
^
/usr/include/php/Zend/zend_portability.h:312:52: note: in definition of macro 'UNEXPECTED'
# define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)
^
/usr/include/php/Zend/zend_operators.h: In function 'void fast_long_decrement_function(zval*)':
/usr/include/php/Zend/zend_operators.h:500:68: error: '__builtin_ssubl_overflow' was not declared in this scope
if (UNEXPECTED(__builtin_ssubl_overflow(Z_LVAL_P(op1), 1, &lresult))) {
^
/usr/include/php/Zend/zend_portability.h:312:52: note: in definition of macro 'UNEXPECTED'
# define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)
^
/usr/include/php/Zend/zend_operators.h: In function 'void fast_long_add_function(zval*, zval*, zval*)':
/usr/include/php/Zend/zend_operators.h:554:80: error: '__builtin_saddl_overflow' was not declared in this scope
if (UNEXPECTED(__builtin_saddl_overflow(Z_LVAL_P(op1), Z_LVAL_P(op2), &lresult))) {
^
/usr/include/php/Zend/zend_portability.h:312:52: note: in definition of macro 'UNEXPECTED'
# define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)
^
/usr/include/php/Zend/zend_operators.h: In function 'void fast_long_sub_function(zval*, zval*, zval*)':
/usr/include/php/Zend/zend_operators.h:657:80: error: '__builtin_ssubl_overflow' was not declared in this scope
if (UNEXPECTED(__builtin_ssubl_overflow(Z_LVAL_P(op1), Z_LVAL_P(op2), &lresult))) {
^
/usr/include/php/Zend/zend_portability.h:312:52: note: in definition of macro 'UNEXPECTED'
# define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)
Ubuntu 18
PHP 7.2
Nginx: 1.15
Python: 3.6.5
OpenCV 3.2.0 : python3-opencv : https://packages.ubuntu.com/bionic/python3-opencv
OpenCV 3.2.0 data: https://packages.ubuntu.com/bionic/opencv-data
PHP facedetect: https://packages.ubuntu.com/bionic/php-facedetect
face_detect('image.jpg', '/usr/share/opencv/haarcascades/haarcascade_frontalface_alt.xml');
generates 502 Bad Gateway with the following logs.
[07-Oct-2018 09:53:28] WARNING: [pool www] child 16390 said into stderr: "OpenCV Error: Unspecified error (The node does not represent a user object (unknown type?)) in cvRead, file /build/opencv-L2vuMj/opencv-3.2.0+dfsg/modules/core/src/persistence.cpp, line 6628"
[07-Oct-2018 09:53:28] WARNING: [pool www] child 16390 said into stderr: "terminate called after throwing an instance of '"
[07-Oct-2018 09:53:28] WARNING: [pool www] child 16390 said into stderr: "cv::Exception"
[07-Oct-2018 09:53:28] WARNING: [pool www] child 16390 said into stderr: "'"
[07-Oct-2018 09:53:28] WARNING: [pool www] child 16390 said into stderr: " what(): "
[07-Oct-2018 09:53:28] WARNING: [pool www] child 16390 said into stderr: "/build/opencv-L2vuMj/opencv-3.2.0+dfsg/modules/core/src/persistence.cpp:6628: error: (-2) The node does not represent a user object (unknown type?) in function cvRead"
[07-Oct-2018 09:53:28] WARNING: [pool www] child 16390 said into stderr: ""
[07-Oct-2018 09:53:28] WARNING: [pool www] child 16390 exited on signal 6 (SIGABRT - core dumped) after 1472.259994 seconds from start
[07-Oct-2018 09:53:28] NOTICE: [pool www] child 17184 started
Hi..today, I'm trying to compile this great extension, but got the following error message
checking /usr/local/include/opencv/cv.h usability... no
checking /usr/local/include/opencv/cv.h presence... no
checking for /usr/local/include/opencv/cv.h... no
configure: error: 'opencv/cv.h' header not found
I've installed opencv 2.3.1 on my FreeBSD 8.2 box by using FreeBSD port tree, while checking /usr/local/include/opencv/cv.h, the header is exist there. I have no idea what's wrong, do you have any advice?
thank you / Ben
Is this one ?
https://code.ros.org/trac/opencv/browser/trunk/opencv_extra/testdata/cv/cascadeandhog/cascade.xml
Happy to know someone has wrapped OpenCV in php extension!! Great Job!! Thank you!!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.