how to copy circle for a new image using imfindcircle?

3 次查看(过去 30 天)
i have this code and i need to copy the circle part of the image to a new image and for the life of me i cant figure out a way to do it.. thanks in advance!!
A = imread('Speed.jpg');
% Resize the image
rowSZ = size(A, 1);
colSZ = size(A, 2);
rows = 250*(colSZ/rowSZ);
J = imresize(A, [rows 250]);
% Show image
imshow(J)
% Set circle radius to find
Rmin = 50;
Rmax = 100;
% Find circles within the raidus
[centers, radii, metric] = imfindcircles(J,[Rmin Rmax]);
% Show circle on the image
viscircles(centers, radii,'EdgeColor','b');

回答(1 个)

Devineni Aslesha
Devineni Aslesha 2020-3-2
Use the code below to copy circle for a new image using 'imfindcircle'.
theta=0:1:360;
r=round(centers(1,1) + radii*sin(theta));
c=round(centers(1,2) + radii*cos(theta));
for j=1:length(r)
B(c(j),r(j),:)=[0 0 255];
end
figure(2)
imshow(B)
For more information, refer the following link.

类别

Help CenterFile Exchange 中查找有关 Images 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by