title: Detecting Many Small Circles in Close Proximity with cv::HoughCircles()
body: <p>I am trying to detect a large number of small circles that are in relatively close proximity to one another (only about 20 pixels apart) using <code>OpenCV</code>. I have managed to create this mask using <code>cv::inRange()</code> and <code>cv::Canny()</code>.</p>
  <p><strong>Original Image</strong></p>
  <p><img src="https://i.stack.imgur.com/2BMHt.jpg" alt="enter image description here" /></p>
  <p><strong>Mask</strong></p>
  <p><img src="https://i.stack.imgur.com/ESin5.png" alt="circle mask" /></p>
  <p>However, when I use <code>cv::HoughCircles()</code> only some of the circles are being detected accurately. Currently, I am using <code>cv::HoughCircles()</code> with the following parameters:</p>
  <pre><code>cv::HoughCircles(mat, circles, CV_HOUGH_GRADIENT, 2, mat.rows / 256, 100, 8, 2, 8);
  </code></pre>
  <p>Is this method not effective enough to detect circles that are this small and close together, or do I simply need to modify the parameters of cv::HoughCircles()?</p>
  <p>Also, it would be useful to get rid of the &quot;noise&quot; surrounding the array of circles in the middle of the mask because some &quot;false circles&quot; are being detected around the edges of the mask. Is there a simple way to do this?</p>