Preprocessing to find circles in image with regionprops or imfindcircles

19 views (last 30 days)
I am really struggling trying to find the circles in my image. Here is the image, as well as the three circles I am hoping to find:
The image is a 512x512 int16. The circles should have a center near (256,256), and the radii are approximatrely 215, 225, and 256.
The image has negative values- the black background is -2000, the innermost blue circle has values around 1020, the area between red and blue is about 1130, and the grey area between the green and red circle is about 40. The .mat file is attached
I'm having a hard time finding these circles with either regionprops or imfindcircles, and I think I need some sort of preprocessing, but not sure what direction to go in. The strange thing is that it seems easiest for me to find the red circle, when I feel the greatest contrast is the green one.
Any help would be much appreciated. Thanks.

Answers (1)

Aravind
Aravind on 24 Oct 2024 at 9:58
It sounds like you're having trouble identifying the centers and radii of three concentric circles in your image using the "imfindcircles" and "regionprops" functions.
After reviewing the image you shared, it seems the matrix representing your image might be incorrect. If you're working with a grayscale image, it should contain values between 0 (black) and 1 (white) to represent pixel intensities. Values like -2000 or 1020 are not valid, so you should normalize your image to ensure values fall within this range.
From the documentation for "regionprops," at https://www.mathworks.com/help/releases/R2023b/images/ref/regionprops.html#buoixjn-1-BW, the input image must be a logical array, which might not be the case with your current setup. Therefore, "regionprops" may not be suitable for finding the centers and radii of the circles in this context.
Additionally, from the documentation at https://www.mathworks.com/help/releases/R2023b/images/ref/imfindcircles.html#btdxntz-4 the "imfindcircles" function has limitations when it comes to detecting concentric circles due to how the Hough transform algorithm works. It tends to reject centers that are very close to each other, which can result in only one circle being detected.
To work around these issues, you can try the following steps to detect concentric circles that are not touching each other:
  1. Use edge detection to find the edges in your image. You can do this with the "edge" function in MATLAB.
  2. Apply the Hough Circle transform to detect circles and store their centers and radii using the "imfindcircles" function.
  3. Perform a connected component search on the edge-detected image using "regionprops" or "bwconncomp" in MATLAB.
  4. For each connected component, check if its center is close to one of the detected Hough circles. It does not need to match exactly, but if it is close, it is likely one of the circles you are looking for. Also, check the eccentricity to confirm the component is circular.
These steps should help you identify the concentric circles in your image.
Here are some documentation links for the functions mentioned, which might be useful:
  1. regionprops - https://www.mathworks.com/help/releases/R2023b/images/ref/regionprops.html
  2. imfindcircles - https://www.mathworks.com/help/releases/R2023b/images/ref/imfindcircles.html
  3. edge - https://www.mathworks.com/help/releases/R2023b/images/ref/edge.html
  4. bwconncomp - https://www.mathworks.com/help/releases/R2023b/images/ref/bwconncomp.html
I hope this helps!

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!