Function to read a 16bit color composite image to matlab
43 views (last 30 days)
Yonatan Degefu on 4 Jul 2017
Hi, I was trying to open a 16 bit color composite image in matlab but everytime it gives me a dark surface when using imread. What is another function I can use to read it into matlab and perform further image analysis.
Walter Roberson on 13 Jul 2017
imread() is probably valid to read the image. Using the Tiff class would be another way.
But the problem is likely not in reading the image, but rather in displaying the image. It is pretty uncommon that the full 16 bit range is used for images stored as 16 bit TIFF: it is more likely that instrument readings are being stored, such as CT images.
It is not uncommon that the used data range for 16 bit TIFF images is roughly -600 to +4000 (technically -4096 to +4095) such as for CT, or roughly 1000 to 6000 (MRI).
You can use imagesc(data), or use imshow(data, ) to have the minimum and maximum stored data mapped across the available colormap.
You will likely find, however, that the data range of interest is only a subset of what is stored. You can pass specific min and max values to imagesc() or imshow() to map the given range across the color map, with lower values mapped to the first color and higher values mapped to the second color.
Once you have identified the range of interest, then you can either zero out everything outside the range, or you can use mat2gray() and pass in the range to map the chosen range to the interval [0, 1].
More Answers (2)
Kelly Kearney on 13 Jul 2017
Many years ago, I had to work with some 16-bit color avi files. Those files stored the RGB color data using 16 bits per pixel: 5 bits each for red, blue, and green, and one bit unused. Assuming your images use a similar encoding, you can probably adapt that code to your tiff images; it's available here: avidread16bitcol.m.