Ask Your Question
0

error in compliling

asked 2013-04-06 01:06:23 -0600

updated 2013-04-06 02:42:21 -0600

berak gravatar image

hi all i use opencv 2.3.1 windows 32bit and visual 2010. i have done all related setting. but i get error when compile my codes.below is my codes:

#include "opencv2/objdetect/objdetect.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"

#include <iostream>
#include <stdio.h>

 using namespace std;
 using namespace cv;

 /** Function Headers */
 void detectAndDisplay( Mat frame );

 /** Global variables */
 String face_cascade_name = "haarcascade_frontalface_alt.xml";
 String eyes_cascade_name = "haarcascade_eye_tree_eyeglasses.xml";
 CascadeClassifier face_cascade;
 CascadeClassifier eyes_cascade;
 string window_name = "Capture - Face detection";
 RNG rng(12345);

 /** @function main */
 int main( int argc, const char** argv )
 {
   CvCapture* capture;
   Mat frame;

   //-- 1. Load the cascades
   if( !face_cascade.load( face_cascade_name ) ){ printf("--(!)Error loading\n"); return -1; };
   if( !eyes_cascade.load( eyes_cascade_name ) ){ printf("--(!)Error loading\n"); return -1; };

   //-- 2. Read the video stream
   capture = cvCaptureFromCAM( -1 );
   if( capture )
   {
     while( true )
     {
   frame = cvQueryFrame( capture );

   //-- 3. Apply the classifier to the frame
       if( !frame.empty() )
       { detectAndDisplay( frame ); }
       else
       { printf(" --(!) No captured frame -- Break!"); break; }

       int c = waitKey(10);
       if( (char)c == 'c' ) { break; }
      }
   }
   return 0;
 }

/** @function detectAndDisplay */
void detectAndDisplay( Mat frame )
{
  std::vector<Rect> faces;
  Mat frame_gray;

  cvtColor( frame, frame_gray, CV_BGR2GRAY );
  equalizeHist( frame_gray, frame_gray );

  //-- Detect faces
  face_cascade.detectMultiScale( frame_gray, faces, 1.1, 2, 0|CV_HAAR_SCALE_IMAGE, Size(30, 30) );

  for( int i = 0; i < faces.size(); i++ )
  {
    Point center( faces[i].x + faces[i].width*0.5, faces[i].y + faces[i].height*0.5 );
    ellipse( frame, center, Size( faces[i].width*0.5, faces[i].height*0.5), 0, 0, 360, Scalar( 255, 0, 255 ), 4, 8, 0 );

    Mat faceROI = frame_gray( faces[i] );
    std::vector<Rect> eyes;

    //-- In each face, detect eyes
    eyes_cascade.detectMultiScale( faceROI, eyes, 1.1, 2, 0 |CV_HAAR_SCALE_IMAGE, Size(30, 30) );

    for( int j = 0; j < eyes.size(); j++ )
     {
       Point center( faces[i].x + eyes[j].x + eyes[j].width*0.5, faces[i].y + eyes[j].y + eyes[j].height*0.5 );
       int radius = cvRound( (eyes[j].width + eyes[j].height)*0.25 );
       circle( frame, center, radius, Scalar( 255, 0, 0 ), 4, 8, 0 );
     }
  }
  //-- Show what you got
  imshow( window_name, frame );
 }

and error is : 'faceRecognition.exe': Loaded 'D:\Visual Studio 2010\Projects\faceRecognition\Debug\faceRecognition.exe', Symbols loaded. 'faceRecognition.exe': Loaded 'C:\Windows\System32\ntdll.dll', Cannot find or open the PDB file 'faceRecognition.exe': Loaded 'C:\Windows\System32\kernel32.dll', Cannot find or open the PDB file 'faceRecognition.exe': Loaded 'C:\Windows\System32\KernelBase.dll', Cannot find or open the PDB file 'faceRecognition.exe': Loaded 'C:\Opencv2.3\opencv\build\x86\vc9\bin\opencv_core231.dll', Cannot find or open the PDB file 'faceRecognition.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4974_none_50940634bcb759cb\msvcp90.dll', Cannot find or open the PDB file 'faceRecognition.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4974_none_50940634bcb759cb\msvcr90.dll', Cannot find or open the PDB file 'faceRecognition.exe': Loaded 'C:\Opencv2.3\opencv\build\x86\vc9\bin\opencv_highgui231.dll', Cannot find or open the PDB file 'faceRecognition.exe': Loaded 'C:\Windows\System32\user32.dll', Cannot find or open the PDB file 'faceRecognition.exe': Loaded 'C ... (more)

edit retag flag offensive close merge delete

Comments

i review again , problem is for these two lines: if( !face_cascade.load( face_cascade_name ) ){ printf("--(!)Error loading\n"); return -1; }; if( !eyes_cascade.load( eyes_cascade_name ) ){ printf("--(!)Error loading\n"); return -1; }; when i do comment these lines program run but not work , two xml file is near project file too

kaveh_dad gravatar imagekaveh_dad ( 2013-04-06 02:27:41 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2013-04-06 02:53:19 -0600

berak gravatar image
  1. you can safely ignore the "Cannot find or open the PDB file" warnings. the PDB's are not shipped with the prebuilt binaries.(you would need them only if you want to step into the opencv-dlls while debugging)

  2. "when i do comment these lines program run but not work " : there's your problem. it can't find the cascade files.

  3. "xml file is near project file too" : but when you start your program from the ide, the exe is in the debug or release folder, so the path to the cascades does not match. to fix this, either:

    • adjust your "Working dir" in the debug settings to point to the projectdir
    • move the cascades to the debug folder
    • change your code , and give an absolute path, like "C:/Program Files/SweetIM/Messenger/haarcascade_frontalface_alt.xml"
edit flag offensive delete link more

Comments

hi, thanks, i try absolute path but it is issue yet. but i resolve haarcascade_frontalface_alt.xml" . bottleneck that cause the error is face_cascade.detectMultiScale( frame_gray, faces, 1.1, 2, 0|CV_HAAR_SCALE_IMAGE, Size(30, 30) ; when i do comment this program run without any error but not work correctly

kaveh_dad gravatar imagekaveh_dad ( 2013-04-06 03:02:06 -0600 )edit

that line should not even compile, there's a ");" missing at the end

berak gravatar imageberak ( 2013-04-06 03:06:54 -0600 )edit

no dear , in real code on my pc ) exist but i get error yet

kaveh_dad gravatar imagekaveh_dad ( 2013-04-06 03:15:39 -0600 )edit

again, what error, where ?

berak gravatar imageberak ( 2013-04-06 03:25:25 -0600 )edit

i trace the line by line ,when i commnet this line //face_cascade.detectMultiScale( frame_gray, faces, 1.1, 2, 0|CV_HAAR_SCALE_IMAGE, Size(30, 30) ); code runs but face and eyes don't detect, when I remove comment ( // ) i get error ( cv::Exception at memory location 0x001ff448.. ) as i explain above

kaveh_dad gravatar imagekaveh_dad ( 2013-04-06 05:21:04 -0600 )edit

I have this problem yet, //face_cascade.detectMultiScale( frame_gray, faces, 1.1, 2, 0|CV_HAAR_SCALE_IMAGE, Size(30, 30) ); when i comment program runs but face isn't detected , when i remove comment ,at first program runs but after several seconds ,it shows error in dialog box , (break,continue , ) and faceRecognition.exe: Native' has exited with code -1073741510 (0xc000013a). and unhandle exception is shown, what do i do ?

kaveh_dad gravatar imagekaveh_dad ( 2013-04-08 10:06:58 -0600 )edit

befor run if i press f7 i see ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ========== but i run the program i encounter unhandle exception, any idea to resolve the issue ?

kaveh_dad gravatar imagekaveh_dad ( 2013-04-08 10:11:36 -0600 )edit

Question Tools

Stats

Asked: 2013-04-06 01:06:23 -0600

Seen: 712 times

Last updated: Apr 06 '13