| AWARE [SYSTEMS] | Imaging expertise for the Delphi developer | |||||||
![]() |
TIFF and LibTiff Mailing List Archive | |||||||
LibTiff Mailing List
TIFF and LibTiff Mailing List Archive Contact
The TIFF Mailing List Homepage |
Thread2004.01.15 18:59 "Re: How to determine number of colors in the colormap", by Bill CassanovaThanks for writing. I wondered about the -1 as well but I saw it in an example and thought I was missing something. The original example was at: http://remotesensing.org/pipermail/tiff/2003-November/000230.html So to read the colormap am I doing it correctly? For some reason the results I am getting are non-sensible. I would have expected to see values in the range of 0 to 255. Instead I am seeing results like from the execution of the code below: bitspersample: 8 num_entries: 255 0 0 0 26214 26214 26214 39321 39321 39321 52428 52428 52428 65535 65535 65535 39321 52428 65535 26214 52428 65535 13107 52428 65535 The code from the original is posted below for convenience. uint16 *red; uint16 *green; uint16 *blue; int num_entries = (1 << bitspersample) - 1; cout << "num_entries: " << num_entries << endl; // get the photmetric interpretation if ((result = TIFFGetField(image_in, TIFFTAG_COLORMAP, &red, &green, &blue)) != 1) { return (false); } else { for (int i = 0; i < num_entries; i++) { cout << red[i] << "\t" << green[i] << "\t" << blue[i] << endl; } } Thanks, Bill |
|||||||