2006.03.31 05:49 "[Tiff] 16-bit TIFF to 8-bit BMP/TIF ???", by Chris L.

2006.03.31 16:05 "RE: [Tiff] 16-bit TIFF to 8-bit BMP/TIF ???", by

> -----Original Message-----

> From: tiff-bounces@lists.maptools.org

> [mailto:tiff-bounces@lists.maptools.org]On Behalf Of Chris L.

I am in the process of writing a program using openCV that analyses 8 bit images. The problem I have is that images produced from a fluorescent camera are 16 bit unsigned greyscale TIFF images (industry standard).

The way I would like to do this is to get every pixels intensity value (16 bit) and Square root it to bring it into the range between 0 and 255.

It sounds like you'll want to do something like this:

You'll probably want to set these tags, at least, before writing your data:

TIFFTAG_PHOTOMETRIC
TIFFTAG_IMAGEWIDTH
TIFFTAG_IMAGELENGTH
TIFFTAG_SAMPLESPERPIXEL (probably 1)
TIFFTAG_BITSPERSAMPLE (probably 8)
TIFFTAG_ORIENTATION (ORIENTATION_TOPLEFT)
TIFFTAG_PLANARCONFIG (probably PLANARCONFIG_CONTIG)
TIFFTAG_ROWSPERSTRIP
TIFFTAG_COMPRESSION

Note, you don't have to write your directory stuff explicitly; it will be done automagically (at least for me, it worked out that way).