2011.06.24 20:40 "[Tiff] 16-bit image", by Leandro Bugnon

2011.06.24 20:40 "[Tiff] 16-bit image", by Leandro Bugnon

Hi,

I'm getting a 14bit image from a CCD cam, and save it in a 16bit. The
problem is that, if I take only 2 gray values (greater than zero and less
than 2^14), the viewers that I try (imageJ and irfanview) take them as zero
and max valuo (black and white), they don't show the real color. How can I
fix it? I've tryed the next tags:

TIFFSetField(TiffFileWriter,TIFFTAG_IMAGEWIDTH, w);

TIFFSetField(TiffFileWriter,TIFFTAG_IMAGELENGTH, h);

TIFFSetField(TiffFileWriter,TIFFTAG_BITSPERSAMPLE, 16);

TIFFSetField(TiffFileWriter,TIFFTAG_COMPRESSION, COMPRESSION_NONE);

TIFFSetField(TiffFileWriter,TIFFTAG_FILLORDER,FILLORDER_MSB2LSB);

TIFFSetField(TiffFileWriter,TIFFTAG_PLANARCONFIG,PLANARCONFIG_CONTIG);

TIFFSetField(TiffFileWriter,TIFFTAG_ORIENTATION,ORIENTATION_TOPLEFT);

TIFFSetField(TiffFileWriter,TIFFTAG_SAMPLESPERPIXEL, 1);

TIFFSetField(TiffFileWriter,TIFFTAG_ROWSPERSTRIP,h);

TIFFSetField(TiffFileWriter,TIFFTAG_XRESOLUTION,Xres);

TIFFSetField(TiffFileWriter,TIFFTAG_YRESOLUTION,Yres);

TIFFSetField(TiffFileWriter,TIFFTAG_RESOLUTIONUNIT,RESUNIT_CENTIMETER);

TIFFSetField(TiffFileWriter,TIFFTAG_MINSAMPLEVALUE,min);

TIFFSetField(TiffFileWriter,TIFFTAG_MAXSAMPLEVALUE,max);

TIFFSetField(TiffFileWriter,TIFFTAG_SMINSAMPLEVALUE,min);

TIFFSetField(TiffFileWriter,TIFFTAG_SMAXSAMPLEVALUE,max);

TIFFSetField(TiffFileWriter,TIFFTAG_PHOTOMETRIC,1);

The values are correctly saved, but it always show a full black and full
white value when there isn't any zero or 2^16 value.

Thanks for help,

Greetings

--

Leandro