how to save image of the result imfindcircle

1 vue (au cours des 30 derniers jours)
raja gopal
raja gopal le 4 Fév 2016
i have used imfindcircle to find circle object in image. do you know how to save the image result of the circle object detected?

Réponses (1)

Jayanti
Jayanti le 21 Mar 2025
Déplacé(e) : Walter Roberson le 21 Mar 2025
You can use “viscircles function to overlay detected circles on the image andimwrite” to write image data.
Please refer to the sample code below for better understanding:
img2 = imread('image.png');
hold on;
[centers, radii, metric] = imfindcircles(img2, [15 416]);
viscircles(centers, radii, 'EdgeColor', 'b');
frame = getframe(gca);
imwrite(frame.cdata, 'annotated_image.jpg');
hold off;
The “getframe” function captures the content of the current figure window. “imwrite” function then saves the captured image as a new file in the current folder.
You can also refer to the below documentation link on “imwrite” for your reference:

Community Treasure Hunt

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

Start Hunting!

Translated by