フィルターのクリア

how to save image of the result imfindcircle

8 ビュー (過去 30 日間)
raja gopal
raja gopal 2015 年 12 月 19 日
回答済み: Michal Heker 2020 年 9 月 24 日
i have used imfindcircle to find circle object in image. do you know how to save the image result of the circle object detected?
  1 件のコメント
Image Analyst
Image Analyst 2015 年 12 月 19 日
編集済み: Image Analyst 2016 年 1 月 3 日
What kind of result do you want? The function imwrite() saves images - why can't you use that? Please explain why that won't work but only after you read this.

サインインしてコメントする。

採用された回答

harjeet singh
harjeet singh 2015 年 12 月 20 日
dear raja, most probable you are using viscircles to highlighter the circles, this commands uses superimposing of graph over the image not actually changes the pixel values.
use this program to save circles with markings
clear all
close all
clc
A = imread('coins.png');
figure(1)
imshow(A)
drawnow
[centers, radii, metric] = imfindcircles(A,[15 30]);
centersStrong5 = centers(1:5,:);
radiiStrong5 = radii(1:5);
metricStrong5 = metric(1:5);
%/////// this command makes plot superimpose on the image not the pixels change permanently
viscircles(centersStrong5, radiiStrong5,'EdgeColor','b');
imwrite(A,'image_out_1.jpg');
%/////// for changing the values of the pixels in the image for making circle //////
B(:,:,1)=A;
B(:,:,2)=A;
B(:,:,3)=A;
for i=1:length(radiiStrong5)
theta=0:1:360;
r=round(centersStrong5(i,1) + radiiStrong5(i)*sin(theta));
c=round(centersStrong5(i,2) + radiiStrong5(i)*cos(theta));
for j=1:length(r)
B(c(j),r(j),:)=[0 0 255];
end
end
figure(2)
imshow(B)
drawnow
imwrite(B,'image_out_2.jpg');
  4 件のコメント
Image Analyst
Image Analyst 2016 年 1 月 3 日
harjeet and I both suggest imwrite(), but we don't know what you want to save because you haven't told us. Remember my comment at the very top where I asked "What kind of result to you want?" Well . . . we still don't have an answer to that question. Why not???
raja gopal
raja gopal 2016 年 2 月 3 日
hello how to make marking circle become thicker? please help :(

サインインしてコメントする。

その他の回答 (2 件)

Alejandro Navarro
Alejandro Navarro 2019 年 3 月 20 日
Hello.
instead of saving the output of a viscircles + image to a file, I would like to assign it as a variable. I have tried "imfuse(Image,Circles)" but this does not work because the circles are not an image, but a "matlab.graphics.primitive.Group". How would I do that related task?
Thanks

Michal Heker
Michal Heker 2020 年 9 月 24 日
How about making a circles mask with imdilate and a disk element structure?
Something like this:
BW = zeros(size(I,1),size(I,2));
for i = 1:length(points)
landmarksMask(points(i,2),(points(i,1)) = 1;
end
BW = imdilate(BW, strel('disk',3));
And duplicate your image with BW.

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by