参考代码
这个里面调用了Matlab的LibTiff库
data = single(magic(10)/10);
outputFileName = 'myfile.tif';
% This is a direct interface to libtiff
t = Tiff(outputFileName,'w');
% Setup tags
% Lots of info here:
% http://www.mathworks.com/help/matlab/ref/tiffclass.html
tagstruct.ImageLength = size(data,1);
tagstruct.ImageWidth = size(data,2);
tagstruct.SampleFormat = Tiff.SampleFormat.IEEEFP;
tagstruct.BitsPerSample = 32;
tagstruct.SamplesPerPixel = 1;
tagstruct.Photometric = Tiff.Photometric.MinIsBlack;
tagstruct.RowsPerStrip = 16;
tagstruct.PlanarConfiguration = Tiff.PlanarConfiguration.Chunky;
tagstruct.Software = 'MATLAB';
t.setTag(tagstruct)
t.write(data);
t.close();
参考链接
http://cn.mathworks.com/help/matlab/ref/tiff-class.html
https://stackoverflow.com/questions/21635851/save-tif-32-bit-images-by-using-imwrite