Reputation: 5444
I am using 2.4.7 version of opencv that supports face recognition. However I am receiving the following error:
/home/fereres/recognition-build-desktop- Qt_4_8_1_in_PATH__System__Release/../recognition/program.cpp:58: error: 'FaceRecognizer' was not declared in this scope
EDIT: The program is working since I've just change computer. I've followed the same instructions to install OpenCV. What could be responsible for that error?? My QT pro file is the following:
QT += core
QT -= gui
TARGET = identification
CONFIG += console/home/fereres/projectCV-build-desktop- Qt_4_8_1_in_PATH__System__Release
CONFIG -= app_bundle
TEMPLATE = app
INCLUDEPATH += /home/fereres/Desktop/OpenCV/opencv-2.4.7/include/opencv \
INCLUDEPATH += /home/fereres/Desktop/OpenCV/opencv-2.4.7/include/opencv2 \
INCLUDEPATH += /home/fereres/Desktop/OpenCV/opencv-2.4.7/modules/core/include/opencv2/core
LIBS += -L/home/fereres/Desktop/OpenCV/opencv-2.4.7/build/lib \
-lopencv_core \
-lopencv_imgproc \
-lopencv_highgui \
-lopencv_ml \
-lopencv_video \
-lopencv_features2d \
-lopencv_calib3d \
-lopencv_objdetect \
-lopencv_contrib \
-lopencv_legacy \
-lopencv_flann
SOURCES += \
program.cpp \
prediction.cpp \
Detection.cpp
HEADERS += \
prediction.h \
Detection.h
The compilation comes out without errors. However when I am running my application I got
./identification: error while loading shared libraries: libopencv_core.so.2.4: cannot open shared object file: No such file or directory
fereres@ubuntu:~/identification-build-desktop-Qt_4_8_1_in_PATH__System__Release$
The /usr/local/lib forlder includes only a python folder I couldn't locate my libs there.
EDIT2: I installed opencv again and now everything is working fine. I guess that the final step of installing opencv didn't work so my /usr/local folder was empty. Now everything is under control.
Upvotes: 0
Views: 2066
Reputation: 93410
It's probably best for you to adjust the INCLUDEPATH
initialization to the following, else every #include
statement that refers to opencv2 at the beginning of the path will cause a compiling error:
INCLUDEPATH += "/home/fereres/Desktop/OpenCV/opencv-2.4.7/include" \
"/home/fereres/Desktop/OpenCV/opencv-2.4.7/include/opencv" \
"/home/fereres/Desktop/OpenCV/opencv-2.4.7/include/opencv2" \
"/home/fereres/Desktop/OpenCV/opencv-2.4.7/modules/core/include/opencv2/core"
Then, at recognition/program.cpp
don't forget to include the appropriate header file:
#include <opencv2/contrib/contrib.hpp>
Note: since you are using pkg-config to add all OpenCV libraries you won't need to do this, but for those people that are specifying the libraries individually, you guys need to add opencv_contrib to LIBS
.
Upvotes: 2