Recognizing a Specific Figure in an Image
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I'm using roipoly to select a specific section of a graph. Afterwards, I subtract the two images to find contrast giving me something like this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/447208/image.jpeg)
How might I write code that can recognize the black circle (within the roipoly region)?/Is it impossible and/or greatly inefficient to do this without modifying the image further (like removing the axes)?
As a side note, the region select may not be a perfect polygon (ie it can be any random polygon)
0 Commenti
Risposte (2)
Shraddha Jain
il 23 Dic 2020
Hi Gabrielle,
There is a function imfindcircles in Image Processing Toolbox which can find circles in an image using Hough transform. Further, you can also investigate the function regionprops and the example given in its documentation on spotting circular objects in an image.
Hope this helps!
0 Commenti
Image Analyst
il 23 Dic 2020
Gabrielle, exactly what does "recognize" mean to you? You call regionprops() to get the centroid, area, or other measurements;
mask = yourImage == 0; % Find black
mask = imclearborder(mask); % Get rid of surround.
mask = imfill(mask, 'holes'); % Fill holes.
mask = bwareafilt(mask, 1); % Take largest ellipse only.
props = regionprops(mask, 'Centroid', 'Area');
area = props.Area
xCenter = props.Centroid(1)
yCenter = props.Centroid(2)
0 Commenti
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!