フィルターのクリア

how to copy circle for a new image using imfindcircle?

1 回表示 (過去 30 日間)
Shoval  Matzner
Shoval Matzner 2020 年 2 月 23 日
回答済み: Devineni Aslesha 2020 年 3 月 2 日
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 Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by