Ask Your Question
0

Cascade Classifier for eye detection- errors while compiling

asked 2013-03-16 05:58:47 -0600

Aditya108 gravatar image

I tried to compile the code given at http://docs.opencv.org/doc/tutorials/objdetect/cascade_classifier/cascade_classifier.html#explanation

got the following errors. whats wrong??

1>------ Build started: Project: testprojectone, Configuration: Debug Win32 ------ 1>objectDetection.obj : error LNK2019: unresolved external symbol "public: bool __thiscall cv::CascadeClassifier::load(class std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> > const &)" (?load@CascadeClassifier@cv@@QAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function _main 1>objectDetection.obj : error LNK2019: unresolved external symbol "public: virtual void __thiscall cv::CascadeClassifier::detectMultiScale(class cv::Mat const &,class std::vector<class cv::rect_<int="">,class std::allocator<class cv::rect_<int=""> > > &,double,int,int,class cv::Size_<int>,class cv::Size_<int>)" (?detectMultiScale@CascadeClassifier@cv@@UAEXABVMat@2@AAV?$vector@V?$Rect_@H@cv@@V?$allocator@V?$Rect_@H@cv@@@std@@@std@@NHHV?$Size_@H@2@2@Z) referenced in function "void __cdecl detectAndDisplay(class cv::Mat)" (?detectAndDisplay@@YAXVMat@cv@@@Z) 1>objectDetection.obj : error LNK2019: unresolved external symbol "public: __thiscall cv::CascadeClassifier::CascadeClassifier(void)" (??0CascadeClassifier@cv@@QAE@XZ) referenced in function "void __cdecl dynamic initializer for 'face_cascade''(void)" (??__Eface_cascade@@YAXXZ) 1>objectDetection.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall cv::CascadeClassifier::~CascadeClassifier(void)" (??1CascadeClassifier@cv@@UAE@XZ) referenced in function "void __cdecldynamic atexit destructor for 'face_cascade''(void)" (??__Fface_cascade@@YAXXZ) 1>C:\Users\Aditya\Documents\Visual Studio 2010\Projects\testprojectone\Debug\testprojectone.exe : fatal error LNK1120: 4 unresolved externals ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

edit retag flag offensive close merge delete

Comments

Thanks for replying! i did link to that library and the code build was complete, but still the output window shows "error loading" meaning that its not able to load the haarcascade xls file. I tried copying the file to the current directory, but still it gives the same error. Am i doing smthing wrong?

Aditya108 gravatar imageAditya108 ( 2013-03-16 07:11:59 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
2

answered 2013-03-16 06:16:20 -0600

berak gravatar image

"unresolved external" you're missing a library.

did you link to opencv_objdetect244d.lib ? (whatever opencv-version, can't see that from yout post)

and, as always, without the d for release mode

edit flag offensive delete link more

Comments

Thanks for replying!

i did link to that library and the code build was complete, but still the output window shows "error loading" meaning that its not able to load the haarcascade xls file. I tried copying the file to the current directory, but still it gives the same error.

Am i doing smthing wrong?

Aditya108 gravatar imageAditya108 ( 2013-03-16 07:07:47 -0600 )edit

xls ? xml !

  1. try giving it an absolute path: "c:/opencv/data/..."
  2. avoid single backslashes"\" (or take two of them"\") since they're used as escape symbols
  3. check the return of cascade.load(), bail out if it could not find it
  4. if you copy it to the same directory, make sure, your program starts there, too (your ide might have other ideas about that)
berak gravatar imageberak ( 2013-03-16 08:30:01 -0600 )edit

This worked!! But the speed of detection is quite slow..What can we do to optimize it?

Aditya108 gravatar imageAditya108 ( 2013-03-23 03:23:16 -0600 )edit

I got the same problem when i tried to implement the code from the link, how did you solve the problem? i dont understand the above suggestion.

phong nguyen gravatar imagephong nguyen ( 2013-12-08 07:05:44 -0600 )edit

@phong nguyen, could you please start a new question ? stuff here gets too confusing else. thanks a lot ;)

berak gravatar imageberak ( 2013-12-08 07:11:01 -0600 )edit

Question Tools

Stats

Asked: 2013-03-16 05:58:47 -0600

Seen: 5,328 times

Last updated: Mar 16 '13