install php extension is success,but run example get error 'CV\Face\FacemarkLBF' not found
vicleos opened this issue · comments
my php version in docker : php7.3
install from php-opencv/php-opencv php7.3 branch
make and make install is success. but make test has error info.
- my system info
php -m:
root@97d369a6a501:/data/php-opencv# php -m
[PHP Modules]
Core
ctype
curl
date
dom
fileinfo
filter
ftp
gd
hash
iconv
json
libxml
mbstring
mysqli
mysqlnd
opencv
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
readline
redis
Reflection
session
SimpleXML
sockets
sodium
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
zip
zlib
[Zend Modules]
make test failed info:
=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
LBPHFaceRecognizer [tests/faceRecognizer.phpt]
LBPHFaceRecognizer with Decode [tests/faceRecognizerDecode.phpt]
FacemarkLBF::create [tests/facemark.phpt]
=====================================================================
use example code:
use CV\CascadeClassifier, CV\Face\FacemarkLBF;
use function CV\{circle, imread, imwrite, cvtColor, equalizeHist, drawContours, putText};
use CV\Scalar;
use CV\Mat;
use const CV\{COLOR_BGR2GRAY};
$src = imread("images/b.jpg");
$gray = cvtColor($src, COLOR_BGR2GRAY);
equalizeHist($gray, $gray);
// face by lbpcascade_frontalface
$faceClassifier = new CascadeClassifier();
$faceClassifier->load('models/lbpcascades/lbpcascade_frontalface.xml');
$faces = null;
$faceClassifier->detectMultiScale($gray, $faces);
//var_export($faces);
php return error:
Fatal error: Uncaught Error: Class 'CV\Face\FacemarkLBF' not found in
Hello. May be you have old version of opecnv.
Please install 4.0.0+
https://github.com/php-opencv/php-opencv/wiki/Installation.-opencv
Or may be you have opencv without extra modules.
my installed opencv version is 4.5.1,platform is mac bigSur m1
pkg-config --modversion opencv4
4.5.1
please run command:
pkg-config --libs opencv4
and try to search opencv_face
in the output.
for example I have tihis:
-L/usr/local/lib -lopencv_gapi -lopencv_stitching -lopencv_aruco -lopencv_bgsegm -lopencv_bioinspired -lopencv_ccalib -lopencv_dnn_objdetect -lopencv_dnn_superres -lopencv_dpm -lopencv_highgui -lopencv_face -lopencv_fuzzy -lopencv_hfs -lopencv_img_hash -lopencv_intensity_transform -lopencv_line_descriptor -lopencv_mcc -lopencv_quality -lopencv_rapid -lopencv_reg -lopencv_rgbd -lopencv_saliency -lopencv_stereo -lopencv_structured_light -lopencv_phase_unwrapping -lopencv_superres -lopencv_optflow -lopencv_surface_matching -lopencv_tracking -lopencv_datasets -lopencv_text -lopencv_dnn -lopencv_plot -lopencv_videostab -lopencv_videoio -lopencv_xfeatures2d -lopencv_shape -lopencv_ml -lopencv_ximgproc -lopencv_video -lopencv_xobjdetect -lopencv_objdetect -lopencv_calib3d -lopencv_imgcodecs -lopencv_features2d -lopencv_flann -lopencv_xphoto -lopencv_photo -lopencv_imgproc -lopencv_core
Did you use my docker config: https://github.com/php-opencv/php-opencv-examples/blob/master/docker/ubuntu-20.10_php-7.3_opencv-4.5.0/Dockerfile ?
I have various of tested and reproducible docker configs:
https://github.com/php-opencv/php-opencv-examples/tree/master/docker
# pkg-config --libs opencv4
-L/usr/local/lib -lopencv_gapi -lopencv_highgui -lopencv_ml -lopencv_objdetect -lopencv_photo -lopencv_stitching -lopencv_video -lopencv_calib3d -lopencv_features2d -lopencv_dnn -lopencv_flann -lopencv_videoio -lopencv_imgcodecs -lopencv_imgproc -lopencv_core
docker images is docker pull php
arm64
oh ~ I didn't find opencv_face
... - _ - ... thanks