AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2017.06.09 18:41 "[Tiff] Read and interpret 16 bit strip data with geo tiff", by Felipe Brubeck
2017.06.09 18:58 "Re: [Tiff] Read and interpret 16 bit strip data with geo tiff", by Bob Friesenhahn
2017.06.09 19:57 "Re: [Tiff] Read and interpret 16 bit strip data with geo tiff", by fbrubeck
2017.06.09 20:18 "Re: [Tiff] Read and interpret 16 bit strip data with geo tiff", by Bob Friesenhahn

2017.06.09 18:41 "[Tiff] Read and interpret 16 bit strip data with geo tiff", by Felipe Brubeck

Hi everyone,

I am new to geotiff and C programming, and I´m having a hard time with both of them.

I'm working on a code that needs to read a 4-channel geotiff image, in this case a 16-bit image (data is actually 12-bit resolution, but is encoded in 16-bit).

My main objective is to read pixel values to use them later. I tried to use TIFFReadEncodedStrip instead of TIFFRGBAImage like this:

buf = (unsigned char*)(_TIFFmalloc(TIFFStripSize(tif)));TIFFReadEncodedStrip(tif,strip,buf,(tsize_t)-1);uint32 *p0 = buf;

printf("strip %d = %d \n", strip, *p0);

and for the p0 value that I print, which I suppose to be the actual image data, I got this:

strip 0 = 20382000

Checking the tags in my image I have found:

Rows per strip: 1 Samples per pixel: 4 Bits per sample: 16 Image orientation: 1 (bottom left)

Planar configuration: 2

Size of buffer: 8 bytes

So my assumption is that the p0 value I'm getting from the buffer, are the four first pixels in the bottom left corner in the first channel of the image. What I don't understand is how do I have to interpret the values of the p0 strip I got.

Opening the image in matlab and checking the first four pixels (bottom-left) in each channel I got 291, 428, 444 and 1473, which doesn't seem to be anything on the p0 value I'm getting.

I don't know if it's because of the 12-bit resolution, or if I have to convert it to a type other than uint32, but I just can't make sense of that number.

Can somebody please give me some pointers on how to handle the image data to store it and manipulate it, and to decipher this number and if it corresponds to the first four pixels in the bottom left corner?

Best wishes,

Felipe.