我有一些图像,正在显示它们并在其上绘制线条,如何将带有绘制线条的原始图像保存为Matlab中的.mat文件?
figure,imshow(geo.^0.25,[]);hold on;
plot(1:512,size(geo,1)-aa,'w','LineWidth',3);
答案 0 :(得分:0)
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中打开它们。