[Image-SIG] Re: Help wanted: sensible way to scale 16-bit grayscale
image
Ray Pasco
pascor at hotpop.com
Thu Dec 16 19:27:22 CET 2004
I believe the response to Russell's question missed the point. I
believe he wants to change the
dynamic range of his images, not produce an image file of a smaller
size, which is the primary
goal of producing a paletted (indexed or gray "L"evel) image. He wants
to manipulate the mapping of values
of the image pixels to grayscale values, which is the "usual" purpose of
a LUT.
The LUT of an L image is not used for that purpose at all !
So, Russel, I think this is what you want to do:
1) Create a palette of 256 8-bit integer indices. This is not a LUT
used as a transform tool.
2) Lets say your image consists of unsigned 16-bit values. Decide the
ranges of values that will be mapped.
E.g., let the range 0-255 map to the new image pallette value of 0, the
original range of 256 .. 511 ==> 1, etc.
In other words, the original value range of [0..255, 256..511, ...]
will transform to the gray level values
of [0, 1, ...]
This is the simplest way to map, which is strictly linear and does not
change the dynamic range, only the "resolution"
of the resultant image. You must create 256 non-overlapping ranges that
cover the original image's pixel range
of 0 to 65,535. It sounds like you will eventually "compand" or
nonlinearize your images for better visual
perception. Create any mapping you want, heuristically or not, whatever
"looks best" to you, in the end.
3) Create a brand new L type image. Install your new pallette into it.
Examine at each pixel of the original image
and map its 16-bit value to a (unique) pallette value. Write that
pallete value to the pixel value of the new image.
You are now done converting the old image to a new L image. Store,
display or even convert to a new image
type as desired.
Now you can see why the pallette table is refered to a a "LUT", though
it is used simply to define the new image,
not transform it. Your mapping algorithm for determination of the old
to new ranges could actually use a LUT
in the conventional sense.
Lets say you have an image that is 1000 X 1000 X 16-bits. This raw
image requires 2,000,000 bytes
to completely describe. Converting to a L image requires a 256 byte
pallette plus 1,000,000 bytes to describe.
It saves space at the cost of pixel value resolution, i.e., compression.
More information about the Image-SIG
mailing list