如何将图像上的绘图线另存为.mat文件

时间:2019-11-16 11:25:16

标签: matlab plot save mat

我有一些图像,正在显示它们并在其上绘制线条,如何将带有绘制线条的原始图像保存为Matlab中的.mat文件?

figure,imshow(geo.^0.25,[]);hold on;
plot(1:512,size(geo,1)-aa,'w','LineWidth',3);

2 个答案:

答案 0 :(得分:0)

您可以使用getframeframe2im

h = figure; %Keep the figure's handle in h
imshow(geo.^0.25,[], 'border', 'tight'); %Plot image without borders
hold on;
plot(1:512,size(geo,1)-aa,'w','LineWidth',3);
I = frame2im(getframe(h)); %Get the displayed "frame", and convert it to image.
save('I.mat', 'I'); %Save I (RGB matrix) to mat file.

答案 1 :(得分:0)

虽然输出是无花果而不是mat文件,但是您可能要看一下matlab savefig命令。它使您可以安全地保存图形并稍后在MATLAB中打开它们。