Only Cascade classifier makes an undefined error
This is a libs part of Qt pro file
LIBS += -LD:/opencv-build/bin/ -llibopencv_core320
LIBS += -LD:/opencv-build/bin/ -llibopencv_highgui320
LIBS += -LD:/opencv-build/bin/ -llibopencv_imgcodecs320
LIBS += -LD:/opencv-build/bin/ -llibopencv_imgproc320
LIBS += -LD:/opencv-build/bin/ -llibopencv_features2d320
LIBS += -LD:/opencv-build/bin/ -llibopencv_calib3d320
LIBS += -LD:/opencv-build/bin/ -llibopencv_videoio320
LIBS += -LD:/opencv-build/bin/ -llibopencv_video320
And this is a code (The only part that uses CascadeClassifier).
cv::String faceCascade = ":/resources/haarcascade_frontalface_alt.xml";
cv::String eyeCascade = ":/resources/haarcascade_eye.xml";
CascadeClassifier faceClassifier;
CascadeClassifier eyeClassifier;
Mat Tracker::detectEyes(Mat& img){
Mat gray;
Mat result;
faceClassifier.load(faceCascade);
eyeClassifier.load(eyeCascade);
cvtColor(img, gray, CV_BGR2GRAY);
std::vector<Rect> face_pos;
faceClassifier.detectMultiScale(gray, face_pos, 1.1, 3, 0 | CV_HAAR_SCALE_IMAGE, Size(10, 10));
for (int i = 0; i < static_cast<int>(face_pos.size()); i++) {
rectangle(result, face_pos[i], Scalar(0, 255, 0), 2);
}
for (int i = 0; i < static_cast<int>(face_pos.size()); i++) {
std::vector<Rect> eye_pos;
Mat roi = gray(face_pos[i]);
eyeClassifier.detectMultiScale(roi, eye_pos, 1.1, 3, 0 | CV_HAAR_SCALE_IMAGE, Size(10, 10));
for (int j = 0; j < static_cast<int>(face_pos.size()); j++) {
Point center(face_pos[i].x + eye_pos[j].x + (eye_pos[j].width / 2),
face_pos[i].y + eye_pos[j].y + (eye_pos[j].height / 2));
int radius = cvRound((eye_pos[j].width + eye_pos[j].height) * 0.2);
circle(result, center, radius, Scalar(0, 0, 255), 2);
}
}
return result;
}
And everything related to CascadeClassifier makes an error.
C:\Users\Coder\Desktop\qt\tracker.cpp:37: error: undefined reference to `cv::CascadeClassifier::load(cv::String const&)'
C:\Users\Coder\Desktop\qt\tracker.cpp:38: error: undefined reference to `cv::CascadeClassifier::load(cv::String const&)'
C:\Users\Coder\Desktop\qt\tracker.cpp:217: error: undefined reference to `cv::CascadeClassifier::detectMultiScale(cv::_InputArray const&, std::vector<cv::Rect_<int>, std::allocator<cv::Rect_<int> > >&, double, int, int, cv::Size_<int>, cv::Size_<int>)'
C:\Users\Coder\Desktop\qt\tracker.cpp:224: error: undefined reference to `cv::CascadeClassifier::detectMultiScale(cv::_InputArray const&, std::vector<cv::Rect_<int>, std::allocator<cv::Rect_<int> > >&, double, int, int, cv::Size_<int>, cv::Size_<int>)'
C:\Users\Coder\Desktop\qt\tracker.cpp:15: error: undefined reference to `cv::CascadeClassifier::~CascadeClassifier()'
C:\Users\Coder\Desktop\qt\tracker.cpp:16: error: undefined reference to `cv::CascadeClassifier::~CascadeClassifier()'
C:\Users\Coder\Desktop\qt\tracker.cpp:15: error: undefined reference to `cv::CascadeClassifier::CascadeClassifier()'
C:\Users\Coder\Desktop\qt\tracker.cpp:16: error: undefined reference to `cv::CascadeClassifier::CascadeClassifier()'
The important thing is, all the other OpenCV classes work fine. Am I missing libs related to CascadeClassifier?