Ask Your Question

Revision history [back]

In the example code you see this appearing somewhere

 /// 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, center, 3, Scalar(0,255,0), -1, 8, 0 );
      // circle outline
      circle( src, center, radius, Scalar(0,0,255), 3, 8, 0 );
   }

  /// Show your results
  namedWindow( "Hough Circle Transform Demo", CV_WINDOW_AUTOSIZE );
  imshow( "Hough Circle Transform Demo", src );

If you do not see your circles display, but just the original image, this means that you have not displayed the adapted image. What this code does is:

  1. Reading in the image (not in code sample here - but in the original guide it is
  2. Using the circle command, you add information to the mat object
  3. When then calling imshow, you actually show the adapted form of the Mat element, and not the original.

Did you check that you used the exact same code? Didn't you adapt names of variables for better understanding for yourself? Check again or post your exact code as from your project.