在Matlab中保存图像输出 [英] Save an imagesc output in Matlab
问题描述
我正在使用imagesc获得完整的图像.但是,我只能显示它,然后必须手动保存它,我找不到用imwrite或imsave从脚本保存图像的方法.可能吗?
I am using imagesc to get an integral image. However, I only manage to display it and then I have to save it by hand, I can't find a way to save the image from the script with imwrite or imsave. Is it possible at all?
代码:
image='C:\image.jpg';
in1= imread((image));
in=rgb2gray(in1);
in_in= cumsum(cumsum(double(in)), 2);
figure, imagesc(in_in);
推荐答案
您还可以使用 print 命令.例如,如果您要运行多个图像并想要对其进行序列化并保存,则可以执行以下操作:
You can also use the print command. For instance if you are running over multiple images and want to serialize them and save them, you can do something like:
% Create a new figure
figure (fig_ct)
% Plot your figure
% save the figure to your working directory
eval(['print -djpeg99 ' num2str(fig_ct)]);
% increment the counter for the next figure
fig_ct = fig_ct+1;
其中fig_ct
只是一个计数器.如果您有兴趣将其保存为不同于jpeg的其他格式,请查看文档,您可以进行tiff,eps等操作.
where fig_ct
is just a counter. If you are interested in saving it in another format different than jpeg take a look at the documentation, you can do tiff, eps, and many more.
希望这对您有帮助
这篇关于在Matlab中保存图像输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!