Fitting some circles to the corner points of an image
조회 수: 2 (최근 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!