# Revision history [back]

### cv::fastNlMeansDenoising does not return

Hi,

I have some problems with cv::findCirclesGrid. Some of my image have very poor contrast and cv::findCircleGrid sometimes takes forever (several minutes) before it returns false.

Therefore, I want to make a better contrast using cv::equalizeHist. The problem with this is, that the image gets really noisy. I tried to denoise it with cv::fastNlMeansDenoising.

I waited several minutes, but the function did not return and I have no idea what to do now.

Has anyone an idea how I could denoise (or generally prepare) my images before using cv::findCirclesGrid? I use Visual Studio 2013 Pro and OpenCv 2.4.9 (x86).

I attach one sample image bevor and after cv::equalizeHist. And here is my code:

for (auto &img : images)
{
cv::Mat gray;

cv::cvtColor(img, gray, CV_BGRA2GRAY);

cv::Mat grayFiltered(gray.rows, gray.cols, gray.type());

//cv::Ptr<cv::CLAHE> clahe = cv::createCLAHE();
//clahe->setClipLimit(2);

//clahe->apply(gray, gray);
cv::equalizeHist(gray, gray);

cv::fastNlMeansDenoising(gray, grayFiltered);
//cv::threshold(gray, gray, 160, 255, CV_THRESH_BINARY); // Needs a different threshold, depending on the actual image
}


low_contrast.png

better_contrast_but_noisy.png