Ask Your Question

kaveh_dad's profile - activity

2017-02-20 06:09:16 -0600 received badge  Popular Question (source)
2015-04-15 03:38:27 -0600 received badge  Student (source)
2013-04-09 23:54:58 -0600 commented answer Unhandled exception after run in face detection

hi, i do all things you suggest me. but unfortunately the problem is exist. First-chance exception at 0x559c61cf in newfaceDetection.exe: 0xC0000005: Access violation writing location 0x00000000. Unhandled exception at 0x559c61cf in newfaceDetection.exe: 0xC0000005: Access violation writing location 0x00000000.

2013-04-09 12:43:57 -0600 asked a question Unhandled exception after run in face detection

hi all,

i am using the following code for face detection:

#include "opencv2/objdetect/objdetect.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/core/core.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( "D:/Visual Studio 2010/Projects/newfaceDetection/haarcascade_frontalface_alt.xml" ) ){ printf("--(!)Error loading\n"); return -1; }
   if( !eyes_cascade.load( "D:/Visual Studio 2010/Projects/newfaceDetection/haarcascade_eye_tree_eyeglasses.xml" ) ){ printf("--(!)Error loading\n"); return -1; }

   frame=imread("d:/1.jpg");
   imshow( "test image", frame );
   if( !frame.empty() )
       { detectAndDisplay( frame ); }
   cvWaitKey(0);

   return 0;
 }

/** @function detectAndDisplay */
void detectAndDisplay( Mat frame )
{
  std::vector<Rect> faces;
    //Mat 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(40, 40) );

  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 );
 }

after I run the code i get the following error

(First-chance exception at 0x0fd761cf in newfaceDetection.exe: 0xC0000005: Access violation writing location 0x00000000. Unhandled exception at 0x0fd761cf in newfaceDetection.exe: 0xC0000005: Access violation writing location 0x00000000.)

if I comment out the following line

( `face_cascade.detectMultiScale( frame_gray, faces, 1.1, 2, 0|CV_HAAR_SCALE_IMAGE, Size(40, 40) );`  )

the program will run without any errors but the face detection doesn't work. It will only show the image.

What do i need to do? I have studied many resources like previous forum questions but I don't reach any positive result yet. please help me , thanks in advance

2013-04-08 10:11:36 -0600 commented answer error in compliling

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 ?

2013-04-08 10:06:58 -0600 commented answer error in compliling

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 ?

2013-04-06 05:21:04 -0600 commented answer error in compliling

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

2013-04-06 03:15:39 -0600 commented answer error in compliling

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

2013-04-06 03:02:06 -0600 commented answer error in compliling

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

2013-04-06 02:27:41 -0600 commented question error in compliling

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

2013-04-06 01:06:23 -0600 asked a question error in compliling

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)

2013-04-05 12:40:06 -0600 commented question a difference between opencv2.3 and 2.4

hi, there is no path in opencv 2.4.4 to setting. but there is in 2.3.1

2013-04-04 03:51:42 -0600 received badge  Editor (source)
2013-04-04 03:27:56 -0600 commented answer error before and when compile

hi, StevenPuttemans First-chance exception at 0x75379617 in faceRecognition.exe: Microsoft C++ exception: cv::Exception at memory location 0x0026f2e8.. Unhandled exception at 0x75379617 in faceRecognition.exe: Microsoft C++ exception: cv::Exception at memory location 0x0026f2e8.. faceRecognition.exe has triggered a breakpoint

2013-04-04 02:48:03 -0600 asked a question a difference between opencv2.3 and 2.4

hi, friends I exteract opencv 2.3 and 2.4 on my computer. for initial setting in windows opencv 2.4 has no a critical path but opencv 2.3 contains this: c:\opencv\build\common\tbb\ia32\vc9 and if i use opencv 2.4 my programs encounter error but the same program works with opencv 2.3 is there any alternative addresse that i set for opencv 2.4 or not ? or my opencv 2.4 release is Incomplete.

thank you in advance.

2013-04-04 02:33:57 -0600 commented answer error before and when compile

opencv_core231.dll is exist and i do related setting. some other of my program working correctly but 'faceRecognition.exe has error , of course i am beginner to opencv. cheers for advice

2013-04-04 02:30:44 -0600 commented answer error before and when compile

hi, thank you for your response. i resolve previous issue but I get another error . about ";" i check and all was ok, I have another problem : '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_509406

2013-04-03 23:57:24 -0600 asked a question error before and when compile

hi, i use opencv 231 and c++ whith visual studio 2010. i use http://docs.opencv.org/doc/tutorials/objdetect/cascade_classifier/cascade_classifier.html tutotial. but cascadeClassifier face_cascade; and cascadeClassifier eyes_cascade; have a error and shown a red line below cascadeClassifier. after compile I get this error:

1>------ Build started: Project: faceRecognition, Configuration: Debug Win32 ------
1>Build started 04/04/2013 09:03:57 ق.ظ.
1>InitializeBuildStatus:
1>  Touching "Debug\faceRecognition.unsuccessfulbuild".
1>ClCompile:
1>  main.cpp
1>d:\visual studio 2010\projects\facerecognition\facerecognition\main.cpp(11): error C2146: syntax error : missing ';' before identifier 'face_cascade'
1>d:\visual studio 2010\projects\facerecognition\facerecognition\main.cpp(11): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\visual studio 2010\projects\facerecognition\facerecognition\main.cpp(11): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\visual studio 2010\projects\facerecognition\facerecognition\main.cpp(12): error C2146: syntax error : missing ';' before identifier 'eyes_cascade'
1>d:\visual studio 2010\projects\facerecognition\facerecognition\main.cpp(12): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\visual studio 2010\projects\facerecognition\facerecognition\main.cpp(12): error C2086: 'int cascadeClassifier' : redefinition
1>          d:\visual studio 2010\projects\facerecognition\facerecognition\main.cpp(11) : see declaration of 'cascadeClassifier'
1>d:\visual studio 2010\projects\facerecognition\facerecognition\main.cpp(12): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\visual studio 2010\projects\facerecognition\facerecognition\main.cpp(18): error C2065: 'Cvcapture' : undeclared identifier
1>d:\visual studio 2010\projects\facerecognition\facerecognition\main.cpp(18): error C2065: 'capture' : undeclared identifier
1>d:\visual studio 2010\projects\facerecognition\facerecognition\main.cpp(21): error C2228: left of '.load' must have class/struct/union
1>          type is 'int'
1>d:\visual studio 2010\projects\facerecognition\facerecognition\main.cpp(22): error C2228: left of '.load' must have class/struct/union
1>          type is 'int'
1>d:\visual studio 2010\projects\facerecognition\facerecognition\main.cpp(25): error C2065: 'capture' : undeclared identifier
1>d:\visual studio 2010\projects\facerecognition\facerecognition\main.cpp(26): error C2065: 'capture' : undeclared identifier
1>d:\visual studio 2010\projects\facerecognition\facerecognition\main.cpp(30): error C2065: 'capture' : undeclared identifier
1>d:\visual studio 2010\projects\facerecognition\facerecognition\main.cpp(52): error C3861: 'equaliseHist': identifier not found
1>d:\visual studio 2010\projects\facerecognition\facerecognition\main.cpp(54): error C2228: left of '.detectMultiScale' must have class/struct/union
1>          type is 'int'
1>d:\visual studio 2010\projects\facerecognition\facerecognition\main.cpp(55): warning C4018: '<' : signed/unsigned mismatch
1>d:\visual studio 2010\projects\facerecognition\facerecognition\main.cpp(57): error C2065: 'point' : undeclared identifier
1>d:\visual studio 2010\projects\facerecognition\facerecognition\main.cpp(57): error C2146: syntax error : missing ';' before identifier 'center'
1>d:\visual studio 2010\projects\facerecognition\facerecognition\main.cpp(57): error C3861: 'center': identifier not found
1>d:\visual studio 2010\projects\facerecognition\facerecognition\main.cpp(58): error C2065: 'center' : undeclared identifier
1>d ...
(more)