I have a collection of 16-bit tif images and I would like to check if all 16 bits are used or I can downscale to an 8-bit representation. What is the best way of doing that? Maybe looking at the histogram? But what should I look after in the histogram? Skewness? (I included the histogram for one of the examples for reference)

 Akzeptierte Antwort

Image Analyst
Image Analyst am 3 Okt. 2020

1 Stimme

It looks like not all 65,535 gray levels are used. Only up to 25,000 are used, and most are less than 6000. I don't know why you want to down-convert to 8 bit. Why? Are you extremely memory limited because you (think) you need to have hundreds of images in memory at the same time? If so, I'd see how you can restructure your program to minimize the number of images in memory at the same time.
If you really want to convert to 8 bit for some reason, I suggest you use imadjust() to adjust it to about 0-6000, and then uint8() and mat2gray() to get it to 0-255 uint8 class:
image8 = uint8(255 * mat2gray(imadjust(image16)));

1 Kommentar

Andreea Dincu
Andreea Dincu am 3 Okt. 2020
The dataset is pretty big and I wanted to understand if it would be possible to do such a transformation without losing that much information. Thank you so much for your answer!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by