How to save a plotted pattern onto an image
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Beatrice Pazzucconi
el 1 de Nov. de 2017
Comentada: student of PU
el 3 de Sept. de 2020
Hi,
I am trying to save an image with a circle drawn on it. I tried with both imwrite and print, but then when I open the file again, the plotted circle is gone.
Image = imread('Eye_00001.jpg');
figure('visible', 'off')
imshow(Image)
% plot circle (CRx and CRy are center coordinates, CRr is radius)
hold on
th = 0:pi/50:2*pi;
xunit = CRr * cos(th) + CRx;
yunit = CRr * sin(th) + CRy;
plot(xunit, yunit, 'r');
% plot the circle center
scatter(CRx, CRy, 20, 'r+');
hold off
% save the image:
save_file_name = strcat(working_directory_name, 'Eye_res_00001.jpg');
imwrite(Image, res_filename)
close(figure)
The version with print changes in the lines:
save_file_name = strcat(working_directory_name, 'Eye_res_00001');
print(res_filename, '-djpeg')
Is there something I'm getting wrong?
Thanks everybody in advance
0 comentarios
Respuesta aceptada
KSSV
el 2 de Nov. de 2017
Image = imread('Eye_00001.jpg');
figure('visible', 'off')
imshow(Image)
% plot circle (CRx and CRy are center coordinates, CRr is radius)
hold on
th = 0:pi/50:2*pi;
xunit = CRr * cos(th) + CRx;
yunit = CRr * sin(th) + CRy;
plot(xunit, yunit, 'r');
% plot the circle center
scatter(CRx, CRy, 20, 'r+');
hold off
F = getframe ;
% save the image:
save_file_name = strcat(working_directory_name, 'Eye_res_00001.jpg');
imwrite(F.cdata, res_filename)
close(figure)
8 comentarios
student of PU
el 3 de Sept. de 2020
i am facing the same problem. i tried this code but still not able to save the image with circle over it. kindly help
Más respuestas (0)
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

