matlab中保存tif图像堆栈能保留原图像格式吗

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了matlab中保存tif图像堆栈能保留原图像格式吗相关的知识,希望对你有一定的参考价值。

参考技术A 有时候我们需要将数字矩阵保存为TIFF格式,在保存过程中,有时候会出现打开保存图片时为片白色情况。没关系,此处教你如何解决。
使用MATLAB保存图像矩阵为TIFF格式方法,首先我们先使用Imread函数打开一副图像I=imread('C:\Users\hzf\Documents\MATLAB\datas\lena.jpg');
使用imwrite 函数将影像保存为TIFF格式,如图像是img,则可以使用imwrite(img,'result.tiff');
有时候会看到保存图像为白色的情况,imwrite(A,filemane)中如果图像A两种可能
1)A数据是整型取值为【0-255】;
2)double类型,取值范围为【0-1.0】;保存显示图像为空白,说明A为本应该为整型,但是实际确实double类型,取值超过规定的1.0,显示为白色;
解决方法:
1)可以使用uint8函数将double转换为[0-255]之间的整型数据,
2)可以将A = A/255,将A缩放到[0-1]区间内,然后imwrite(A,filemane)。

matlab有函数能自动保存图吗

用plot画了一个图,有函数能让这个图以matlab的形式自动保存吗

Matlab提供直来接的saveas函数可以将自指知定figure中的图道像

调用举例:

>> h=figure

h =

1

>> plot(rand(2,4))

>> saveas(h,'hello','jpg')

扩展资料:

MATLAB包括拥有数百个内部函数的主包和三十几种工具包。工具包又可以分为功能性工具包和学科工具包。功能工具包用来扩充MATLAB的符号计算,可视化建模仿真,文字处理及实时控制等功能。学科工具包是专业性比较强的工具包,控制工具包,信号处理工具包,通信工具包等都属于此类。

图形处理系统使得MATLAB能方便的图形化显示向量和矩阵,而且能对图形添加标注和打印。它包括强大的二维三维图形函数、图像处理和动画显示等函数。

参考技术A Matlab提供直接的saveas函数可以将指定figure中的图像
例如
x=-pi:pi/20:pi;
for i=1:4
y(:,i)=sin(i*x);
text=['figure',num2str(i)]
figure(i)
plot(x',y(:,i))
title(text)
h1 = figure(i);
name1=['figure',num2str(i),'.jpg']
name1=['figure',num2str(i),'.fig']
saveas(h1,name1);
saveas(h1,name2);
end追问

请问saveas执行后,这个图存哪里了

追答

当前目录下面

追问

能存指定路径吗

追答

好像不行
help saveas
SAVEAS Save Figure or Simulink block diagram in desired output format
SAVEAS(H,'FILENAME')
Will save the Figure or Simulink block diagram with handle H to file
called FILENAME.
The format of the file is determined from the extension of FILENAME.

SAVEAS(H,'FILENAME','FORMAT')
Will save the Figure or Simulink block diagram with handle H to file
called FILENAME in the format specified by FORMAT. FORMAT can be the
same values as extensions of FILENAME.
The FILENAME extension does not have to be the same as FORMAT.
The specified FORMAT overrides FILENAME extension.

Valid options for FORMAT are:

'fig' - save figure to a single binary FIG-file. Reload using OPEN.
'm' - save figure to binary FIG-file, and produce callable
MATLAB code file for reload.
'mfig' - same as M.
'mmat' - save figure to callable MATLAB code file as series of creation
commands with param-value pair arguments. Large data is saved
to MAT-file.
Note: MMAT Does not support some newer graphics features. Use
this format only when code inspection is the primary goal.
FIG-files support all features, and load more quickly.

Additional FORMAT options include devices allowed by PRINT.

本回答被提问者和网友采纳
参考技术B 用saveas就可以,saveas(h,'filename','format') ,h是当前图的句柄,filename打算保存图片的路径,format是保存的格式,可以是jpg或fig等格式。
官方解释:SaveAs on the figure window menu to accessthe Save As dialog, in which you can select a graphics format. Fordetails, see Exporting in a Specific Graphics Format in the MATLAB® Graphicsdocumentation. Sizes of files written to image formats by this GUIand by saveas can differ due to disparate resolutionsettings.
调用举例:
>> h=figure
h =
1
>> plot(rand(2,4))
>> saveas(h,'hello','jpg')

以上是关于matlab中保存tif图像堆栈能保留原图像格式吗的主要内容,如果未能解决你的问题,请参考以下文章

请问,matlab中,如何将一幅从原图截取出来的一部分,还保存为原图的格式呢?

matlab图像处理教程

matlab对图像去噪后怎么求信噪比

tif格式有坐标吗

MATLAB中psnr函数如何使用?或者说,有直接可调用的psnr函数吗?像snr函数一样

图像的二维频谱图的理解 20170622