how to save the image to which viscircles (centers, radii) apply?
    2 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
I'm new to Matlab and I have a problem. The binarized image is saved and the one I want to save is the image that viscircles applies (centers, radii).
for i=1:totalimag
    imag{i}=importdata(fullfile(ruta,imag{i}),' ');
    %binarizar img
    imgbn{i}=rgb2gray(imag{i});
    [centers,radii] = imfindcircles(imgbn{i},[5 30],'ObjectPolarity','Dark',...
         'Sensitivity',0.92);
    imshow(imgbn{i}) 
    %se dibujan círculos en imgbn
    h{i} = viscircles(centers,radii);
    eval(sprintf(' var%d = centers,radii', i))
    carpeta='C:\Users\angel\Desktop\programas\Matlabt';
    namefile= [carpeta, '\imacept', num2str(i), '.jpg'];
    imwrite(imgbn{i},namefile)
end
0 comentarios
Respuestas (1)
  Jayanti
 el 1 de Abr. de 2025
        Hi Angelo,
To save the images with the circles drawn in it you can capture the figure with the circles and save it.
Please refer to the below code:
hFig = figure; 
imshow(imgbn{i});
hold on;
viscircles(centers, radii);
saveas(hFig, filename); 
close(hFig); 
The above code will display the image by creating a figure window. “saveas” is used to save the current figure with the circles drawn on it with the file “filename”. Specify the file name as a character vector or string that includes a file extension. If not, then “saveas” saves the figure to a FIG-file.
I am also attaching documentation link on “saveas” for your reference:
Hope this will be helpful!
0 comentarios
Ver también
Categorías
				Más información sobre Geometric Transformation and Image Registration en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

