Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hi , Sorry I forget to include the code

   #include "opencv2/opencv.hpp"
   using namespace cv;

  int main(int, char**)
  {
   VideoCapture cap("eye.mp4"); // open the default camera
 if(!cap.isOpened())  // check if we succeeded
   return -1;

  namedWindow("Video",1);
   while(1)
 {
Mat frame,grey,edge,draw,src_gray;
cap >> frame; 
cvtColor( frame, grey, CV_BGR2GRAY );   // get a new frame from   camera

Canny( grey, edge, 50, 150, 3);
edge.convertTo(draw, CV_8U);
GaussianBlur( edge, src_gray, Size(9, 9), 2, 2 );

  vector<Vec3f> circles;


  HoughCircles( src_gray, circles, CV_HOUGH_GRADIENT, 1,   src_gray.rows/8, 200, 100, 0, 0 );

 /// Draw the circles detected
   for( size_t i = 0; i < circles.size(); i++ )
    {
    Point center(cvRound(circles[i][0]), cvRound(circles[i][1]));
  int radius = cvRound(circles[i][2]);
 // circle center
 circle( src_gray, center, 3, Scalar(0,255,0), -1, 8, 0 );
 // circle outline
 circle( src_gray, center, radius, Scalar(0,0,255), 3, 8, 0 );
 }
 imshow("Video", src_gray);


// Press 'c' to escape
  if(waitKey(30) == 'c') break;
 }
return 0;
 }

Hi , Sorry I forget to include the code

   #include "opencv2/opencv.hpp"
   using namespace cv;

  int main(int, char**)
  {
   VideoCapture cap("eye.mp4"); // open the default camera
 if(!cap.isOpened())  // check if we succeeded
   return -1;

  namedWindow("Video",1);
   while(1)
 {
Mat frame,grey,edge,draw,src_gray;
cap >> frame; 
cvtColor( frame, grey, CV_BGR2GRAY );   // get a new frame from   camera

Canny( grey, edge, 50, 150, 3);
edge.convertTo(draw, CV_8U);
GaussianBlur( edge, src_gray, Size(9, 9), 2, 2 );

  vector<Vec3f> circles;


  HoughCircles( src_gray, circles, CV_HOUGH_GRADIENT, 1,   src_gray.rows/8, 200, 100, 0, 0 );

 /// Draw the circles detected
   for( size_t i = 0; i < circles.size(); i++ )
    {
    Point center(cvRound(circles[i][0]), cvRound(circles[i][1]));
  int radius = cvRound(circles[i][2]);
 // circle center
 circle( src_gray, center, 3, Scalar(0,255,0), -1, 8, 0 );
 // circle outline
 circle( src_gray, center, radius, Scalar(0,0,255), 3, 8, 0 );
 }
 imshow("Video", src_gray);


// Press 'c' to escape
  if(waitKey(30) == 'c') break;
 }
return 0;
 }