Recognizing a Specific Figure in an Image
1 回表示 (過去 30 日間)
古いコメントを表示
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:
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 件のコメント
回答 (2 件)
Shraddha Jain
2020 年 12 月 23 日
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 件のコメント
Image Analyst
2020 年 12 月 23 日
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 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!