In MATLAB, how do I set the bit depth property for TIFF-files using the IMWRITE function?

I would like to set the bit depth property for TIFF-files using the IMWRITE function.

 採用された回答

You can set the bit depth of your image based on the type of data you are writing. IMWRITE figures out what to do based on the datatype that you pass it.
The following example can be used to store 16-bit data in TIFF-files. Please pass IMWRITE UINT16 data to set the bit depth to 16.
load trees
I = ind2rgb(X,map);
imshow(I)
I2 = uint16(255 * I);
I3 = bitshift(I2, 8);
imwrite(I3, '16bit.tif');
I4 = imread('16bit.tif');
figure; imshow(I4)
whos
Name Size Bytes Class
I 258x350x3 2167200 double array
I2 258x350x3 541800 uint16 array
I3 258x350x3 541800 uint16 array
I4 258x350x3 541800 uint16 array
X 258x350 722400 double array
caption 1x66 132 char array
map 128x3 3072 double array

その他の回答 (0 件)

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by