Fitting some circles to the corner points of an image
4 次查看(过去 30 天)
显示 更早的评论
Hi everyone,
I am working on the image of asphalt aggregates and I am going to extract some properties of them ( such as roundness). To compute this index, I need the circles which fitted to the curved part of the object(as can be seen in the image that I have uploaded). As you can see in the picture, I need the radius of the green circles. Do you know how can I extract them?
For finding the coordinates of boundary points from images, I used the following functions;
b=imread('aggregate.png');
BW = im2bw(b,0.36);
boundaries = bwboundaries(BW);
numberOfBoundaries = size(boundaries, 1);
hold on;
for k = 1 : numberOfBoundaries
thisBoundary = boundaries{k};
x = thisBoundary(:,2);
y= thisBoundary(:,1);
end
And then I tried to use function 'circfit' to fit a circle to the corner(or curved part) but I couldnt.
0 个评论
回答(1 个)
Amit Dhakite
2023-6-8
Hi Narges,
To find out details about the circles from an image, you can consider the following code which detects circles in an image and returns their centers as well as radii using "imfindcircles()" functon.
% Read the image
rgb = imread("https://www.mathworks.com/matlabcentral/answers/uploaded_files/1201918/aggregate.png");
imshow(rgb);
% Extract their centers and radii using imfindcircles()
[centers,radii] = imfindcircles(rgb,[20 25],"ObjectPolarity","dark", "Sensitivity",0.955, ...
"Method","twostage")
fprintf("Number of circles detected: %d", length(centers));
To know more about detecting circles in an image, kindly refer to the following links:
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!