Hough transform in matlab vs opencv cpp
<p>I have the following image: 
<br> <a href="https://i.stack.imgur.com/f9jQY.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/f9jQY.jpg" alt=""></a>
<br> When I use hough transform in MATLAB, I get 100% detection of circles.</p>

<p>I use the following code in MATLAB:</p>

<pre><code>[centersDark, radiiDark] = imfindcircles(closed_pic,[Rmin Rmax],'ObjectPolarity','dark');
</code></pre>

<p>I use the following code in cpp:</p>

<pre><code>cv::medianBlur(mat, mat, 5);    
cv::Mat grayMat;     
cv::cvtColor(mat, grayMat, cv::COLOR_BGR2GRAY);     
std::vector&lt;cv::Vec3f&gt; circles1;     
cv::HoughCircles(grayMat, circles1, CV_HOUGH_GRADIENT, 1, 20, 30, 30, 0, 0); 
</code></pre>

<p>Also when I try to run hough transforn in cpp on binary image, I don't get any detection. What can I do to make it work?</p>