how to save image of the result imfindcircle

i have used imfindcircle to find circle object in image. do you know how to save the image result of the circle object detected?

Respuestas (1)

Jayanti
Jayanti el 21 de Mzo. de 2025
Movida: Walter Roberson el 21 de Mzo. de 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:

Preguntada:

el 4 de Feb. de 2016

Movida:

el 21 de Mzo. de 2025

Community Treasure Hunt

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

Start Hunting!

Translated by