Is there a way to detect circles with radii smaller than 10 pixels?

5 views (last 30 days)
I am trying to look for small, red dots in an image, but the dots are usually less than 10 pixels large. imfindcircles finds every circle but the ones I am looking for, including a lot of phantom circles. Is there any way to accurately detect these circles?

Accepted Answer

Image Analyst
Image Analyst on 9 Nov 2015
Simply use color segmentation. I have several demos in my File Exchange: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
  8 Comments
AG
AG on 14 Nov 2015
Sorry about that! I downloaded the SimpleColorDetection file and ran it without any modifications. Here is the code that ran right before the error-
% Plot all 3 histograms in one plot. subplot(3, 4, 5); plot(grayLevelsR, countsR, 'r', 'LineWidth', 2); grid on; xlabel('Gray Levels'); ylabel('Pixel Count'); hold on; plot(grayLevelsG, countsG, 'g', 'LineWidth', 2); plot(grayLevelsB, countsB, 'b', 'LineWidth', 2); title('Histogram of All Bands', 'FontSize', fontSize); maxGrayLevel = max([maxGLValueR, maxGLValueG, maxGLValueB]); % Trim x-axis to just the max gray level on the bright end. if eightBit xlim([0 255]); else xlim([0 maxGrayLevel]); end
% Now select thresholds for the 3 color bands. message = sprintf('Now we will select some color threshold ranges\nand display them over the histograms.'); reply = questdlg(message, 'Continue with Demo?', 'OK','Cancel', 'OK'); if strcmpi(reply, 'Cancel') % User canceled so exit. return; end
Right after this piece of code, the program gave the error that the image exceeds the matrix dimensions.
Image Analyst
Image Analyst on 14 Nov 2015
I ran it for each of the 3 demo images and it worked flawlessly. What image did you use? I even said to use it on one of my own (attached) and that also worked. I'm sorry I can't reproduce your error. You'll either have to post the image you used or put in some debugging statements.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!