Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Error loading xml file.

An xml file could not be loaded when running the project on Visual Studio but the .exe of the project runs perfectly.

const char cascade_name="output.xml"; int lastX = -1; int lastY = -1; void detect_and_draw( IplImage img ) {

// Create memory for calculations
static CvMemStorage* storage = 0;
// Create a new Haar classifier
static CvHaarClassifierCascade* cascade = 0;
// Sets the scale with which the rectangle is drawn with
int scale = 1;
// Create two points to represent the hand locations
//CvPoint pt1, pt2;
// Looping variable

// int i; // Load the HaarClassifierCascade cascade = (CvHaarClassifierCascade*)cvLoad(cascade_name,0,0,0); // Check whether the cascade has loaded successfully. Else report and error and quit

// Allocate the memory storage
storage = cvCreateMemStorage(0);
// Create a new named window with title: result
cvNamedWindow( "result", 1 );
// Clear the memory storage which was used before
cvClearMemStorage( storage );
if(!cascade)
{
    fprintf( stderr, "ERROR: Could not load classifier cascade\n" );
    return;
}

can somebody tell me what went wrong?

click to hide/show revision 2
fixed formatting

Error loading xml file.

An xml file could not be loaded when running the project on Visual Studio but the .exe of the project runs perfectly.

const char cascade_name="output.xml";
*cascade_name="output.xml";
int lastX = -1;
int lastY = -1;
void detect_and_draw( IplImage IplImage* img )
{

{
// Create memory for calculations
 static CvMemStorage* storage = 0;
 // Create a new Haar classifier
 static CvHaarClassifierCascade* cascade = 0;
 // Sets the scale with which the rectangle is drawn with
 int scale = 1;
 // Create two points to represent the hand locations
 //CvPoint pt1, pt2;
 // Looping variable

// int i; // Load the HaarClassifierCascade cascade = (CvHaarClassifierCascade*)cvLoad(cascade_name,0,0,0); // Check whether the cascade has loaded successfully. Else report and error and quit

 // Allocate the memory storage
 storage = cvCreateMemStorage(0);
 // Create a new named window with title: result
 cvNamedWindow( "result", 1 );
 // Clear the memory storage which was used before
 cvClearMemStorage( storage );
 if(!cascade)
 {
  fprintf( stderr, "ERROR: Could not load classifier cascade\n" );
 return;
 }

can somebody tell me what went wrong?

click to hide/show revision 3
removed hash from tags

Error loading xml file.

An xml file could not be loaded when running the project on Visual Studio but the .exe of the project runs perfectly.

const char *cascade_name="output.xml";
int lastX = -1;
int lastY = -1;
void detect_and_draw( IplImage* img )
{

    // Create memory for calculations
    static CvMemStorage* storage = 0;
    // Create a new Haar classifier
    static CvHaarClassifierCascade* cascade = 0;
    // Sets the scale with which the rectangle is drawn with
    int scale = 1;
    // Create two points to represent the hand locations
    //CvPoint pt1, pt2;
    // Looping variable
   // int i;
    // Load the HaarClassifierCascade
    cascade = (CvHaarClassifierCascade*)cvLoad(cascade_name,0,0,0);
    // Check whether the cascade has loaded successfully. Else report and error and quit  

    // Allocate the memory storage
    storage = cvCreateMemStorage(0);
    // Create a new named window with title: result
    cvNamedWindow( "result", 1 );
    // Clear the memory storage which was used before
    cvClearMemStorage( storage );
    if(!cascade)
    {
        fprintf( stderr, "ERROR: Could not load classifier cascade\n" );
        return;
    }

can somebody tell me what went wrong?

Error loading xml file.

An xml file could not be loaded when running the project on Visual Studio but the .exe of the project runs perfectly.

const char *cascade_name="output.xml"; cascade_name="output.xml"; int lastX = -1; int lastY = -1; void detect_and_draw( IplImage* IplImage img ) { {

// Create memory for calculations
 static CvMemStorage* storage = 0;
 // Create a new Haar classifier
 static CvHaarClassifierCascade* cascade = 0;
 // Sets the scale with which the rectangle is drawn with
 int scale = 1;
 // Create two points to represent the hand locations
 //CvPoint pt1, pt2;
 // Looping variable
 

// int i; // Load the HaarClassifierCascade cascade = (CvHaarClassifierCascade*)cvLoad(cascade_name,0,0,0); // Check whether the cascade has loaded successfully. Else report and error and quit

// Allocate the memory storage
 storage = cvCreateMemStorage(0);
 // Create a new named window with title: result
 cvNamedWindow( "result", 1 );
 // Clear the memory storage which was used before
 cvClearMemStorage( storage );
 if(!cascade)
 {
  fprintf( stderr, "ERROR: Could not load classifier cascade\n" );
 return;
 }
if( cascade )
{
// There can be more than one hand in an image. So create a growable sequence of hands.
// Detect the objects and store them in the sequence
CvSeq* hands = cvHaarDetectObjects( img, cascade, storage,
1.1, 2, CV_HAAR_DO_CANNY_PRUNING,
cvSize(40, 40) );
// Loop the number of hands found.
for( i = 0; i < (hands ? hands->total : 0); i++ )
{
// Create a new rectangle for drawing the hand
CvRect* r = (CvRect*)cvGetSeqElem( hands, i );
// Find the dimensions of the hand,and scale it if necessary
pt1.x = r->x*scale;
pt2.x = (r->x+r->width)*scale;
pt1.y = r->y*scale;
pt2.y = (r->y+r->height)*scale;
// Draw the rectangle in the input image
cvRectangle( img, pt1, pt2, CV_RGB(230,20,232), 3, 8, 0 );
}
}
// Show the image in the window named "result"
cvShowImage( "result", img );

}

can somebody tell me what went wrong?

click to hide/show revision 5
fixed source code formatting and removed hashes form tags

Error loading xml file.

An xml file could not be loaded when running the project on Visual Studio but the .exe of the project runs perfectly.

const char cascade_name="output.xml";
*cascade_name="output.xml";
int lastX = -1;
int lastY = -1;
void detect_and_draw( IplImage IplImage* img )
{

{
// Create memory for calculations
 static CvMemStorage* storage = 0;
 // Create a new Haar classifier
 static CvHaarClassifierCascade* cascade = 0;
 // Sets the scale with which the rectangle is drawn with
 int scale = 1;
 // Create two points to represent the hand locations
 //CvPoint pt1, pt2;
 // Looping variable

// int i; // Load the HaarClassifierCascade cascade = (CvHaarClassifierCascade*)cvLoad(cascade_name,0,0,0); // Check whether the cascade has loaded successfully. Else report and error and quit

 // Allocate the memory storage
 storage = cvCreateMemStorage(0);
 // Create a new named window with title: result
 cvNamedWindow( "result", 1 );
 // Clear the memory storage which was used before
 cvClearMemStorage( storage );
 if(!cascade)
 {
  fprintf( stderr, "ERROR: Could not load classifier cascade\n" );
 return;
 }
 if( cascade )
 {
  // There can be more than one hand in an image. So create a growable sequence of hands.
 // Detect the objects and store them in the sequence
 CvSeq* hands = cvHaarDetectObjects( img, cascade, storage,
 1.1, 2, CV_HAAR_DO_CANNY_PRUNING,
 cvSize(40, 40) );
  // Loop the number of hands found.
  for( i = 0; i < (hands ? hands->total : 0); i++ )
 {
  // Create a new rectangle for drawing the hand
 CvRect* r = (CvRect*)cvGetSeqElem( hands, i );
  // Find the dimensions of the hand,and scale it if necessary
 pt1.x = r->x*scale;
 pt2.x = (r->x+r->width)*scale;
 pt1.y = r->y*scale;
 pt2.y = (r->y+r->height)*scale;
  // Draw the rectangle in the input image
  cvRectangle( img, pt1, pt2, CV_RGB(230,20,232), 3, 8, 0 );
 }
 }
 // Show the image in the window named "result"
 cvShowImage( "result", img );

}

}

can somebody tell me what went wrong?