[Geotiff] 16 bits per pixel images
Frank Warmerdam
fwarmerdam at gmail.com
Mon Sep 5 17:38:03 EDT 2005
On 8/31/05, Barry A. Rich <brich at trisectrix.com> wrote:
> I'm looking for guidance on how to handle images with 16 bits per pixel.
>
> If the image has 16 bits per pixel, I'm assuming the following buffer would
> be allocated to read one scan line:
>
> unsigned short* ScanlineBuf = (unsigned short*) malloc( TIFFScanlineSize(
> tiff ) ); Each scan line would then be read as follows:
>
> TIFFReadScanline( tiff, ScanlineBuf, row, 0 );
Barry,
Whether you get red, green and blue or just red back will depend on
the organization of the file. If it has a CONTIG planarconfiguration then
it will return them all. If it has a SEPARATE planar configuration then
it will only return one sample (red in this case).
> I'm assuming ScanlineBuf is a series of 16-bit red, green, and blue colors.
> Can someone verify that and tell me how to convert the 16-bit colors to
> 8-bit values?
For full dynamic range data, you can just down shift the data by 8bits
to get 8bit data. For remote sensing sensor 16bit data you will typically
need to make a pass determining suitable min/max values for linear
scaling. In some cases even more sophisticated downscaling approaches
may be suitable.
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
More information about the Geotiff
mailing list