Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

main.cpp:59:1: error: ‘capture’ was not declared in this scope capture = cvCaptureFromCAM( 0 );

I was following a tutorial on web for an OpenCV library to detect eyes

when i compile it this error appears I tried to fix it but didn't find a

solution.

main.cpp:59:1: error: ‘capture’ was not declared in this scope capture = cvCaptureFromCAM( 0 );

The code is long I put only the part that I think causing this error Full code

Thanks

#include <opencv2/objdetect/objdetect.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>

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

#include "constants.h"
#include "findEyeCenter.h"
#include "findEyeCorner.h"



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

  int main( ) 
{

 cv::Mat frame;

 if( !face_cascade.load( face_cascade_name ) ){ printf("--(!)Error loading face cascade, please change face_cascade_name in source code.\n"); return -1; };

 createCornerKernels();
  ellipse(skinCrCbHist, cv::Point(113, 155.6), cv::Size(23.4, 15.2),
  43.0, 0.0, 360.0, cv::Scalar(255, 255, 255), -1);

capture = cvCaptureFromCAM( 0 );

if( capture)

{
   while( true ) 

 {

 frame = cvQueryFrame( capture );
 // mirror it
 imshow("Video",frame);
 cv::flip(frame, frame, 1);
 frame.copyTo(debugImage);

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

  imshow(main_window_name,debugImage);

   int c = cv::waitKey(10);
   if( (char)c == 'c' ) { break; }
   if( (char)c == 'f' ) {
   imwrite("frame.png",frame);
  }

  }
  }

  releaseCornerKernels();

  return 0;
 }
}