Hi there

I tried to search via google and this forum for an equivalent problem, did not found... I'm trying to make a facedetector program using opencv and qt, using some tutorials code (I'm quite new to C++)... problem is with the methods of CascadeClassifier, apparently and for a strange reason, it's not linking correctly with the library

here's the code :

void ThreadVideoProcess::run()
{
{
while(1)
{
videoBuffer->get(matCvImage);
Mat original = matCvImage.clone();
Mat gray;
cvtColor(original, gray, CV_BGR2GRAY);
vector< Rect_<int> > faces;
for(int i = 0; i < faces.size(); i++) {
Rect face_i = faces[i];
Mat face = gray(face_i);
Mat face_resized;
cv::resize(face, face_resized, Size(640, 480), 1.0, 1.0, INTER_CUBIC);
rectangle(original, face_i, CV_RGB(0, 255,0), 1);
}
qtImageLabel->setPixmap(QPixmap::fromImage(MatToQImage(original)));
}
}
}


I get those unique debug errors :

"undefined reference to cv::CascadeClassifier::load(std::string const&)'

"undefined reference to cv::CascadeClassifier::detectMultiScale(cv::Mat const&, std::vector<cv::rect_<int>, std::allocator<cv::rect_<int> > >&, double, int, int, cv::Size_<int>, cv::Size_<int>)'

Libraries included are : libopencv_core300d.dll.a libopencv_objdetect300d.dll.a libopencv_imgproc300d.dll.a libopencv_highgui300d.dll.a

Strange thing is when I remove the libopencv_objdetec300d.dll.a library, I get more errors like :

undefined reference to cv::CascadeClassifier::CascadeClassifier()'

...and when I put this library again, I only, but still, get the errors described above... like the compiler finds the library for the CascadeClassifier class, but not for its methods!!!

I guess I'm missing some basics, as I said I'm pretty new to C++ so I don't think it's a bug...

Got stucked for 3 days now, so any help or idea would be veeerryyyy helpful !!!

Codeblocks 13.12 on win7

Qt Qt5.2.1.minGw48.openGL

openCV 2.4.8 build via CMAKE in DEBUG mode MinGW32

edit retag close merge delete

Sort by » oldest newest most voted

you seem to use opencv 3.0 here. (not 2.4.8, just look at the libs)

they changed all of the std::string to cv::String there, so, while you code compiles correctly ( yes, both string types are compatible there ) , your linker has a different opinion on it.

try:

cv::String yo = ...


i'm not sure, why it chokes on the Rect vector, maybe

  vector< Rect > faces;


helps. ( well, if so, i'd say, at least that is worth reporting an issue. )

if you forked or cloned the code from github, the master(3.0) branch is the default one.

if you want 2.4.8 instead, do:

 git checkout 2.4
`

and rebuild the whole schlepp (cmake and all).

PS. i'm wondering, why it did not complain about CV_BGR2GRAY. did you include one of the c-headers ?

more

(my last post apparently did not work) you were right, I was using the v3.0 without knowing it, because of git... I donwload the 2.4 branch, re-compil and got still some problems but the above linking errors are gone ! thanks a lot !

(concerning cv_bgr2gray I included only imgproc and contrib... didn't get any problem with that...)

cheers

( 2014-04-12 11:02:48 -0500 )edit

Official site

GitHub

Wiki

Documentation