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

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

figure,imshow(geo.^0.25,[]);hold on;
plot(1:512,size(geo,1)-aa,'w','LineWidth',3);
doctorzzr 回答:如何将图像上的绘图线另存为.mat文件

您可以使用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.
,

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

本文链接:https://www.f2er.com/3090475.html

大家都在问