| 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.07.11 18:57 "Re: sampleper pixel", by Frank WarmerdamBalint Radics wrote:
> Hi,
>
> I am balint and I have some question concerning tiff and libtiff.
> I have a tiff picture.This picture was made such that there was a
> measurment
> where single photons fell into the pixels of a detector and thus we got a
> matrix of (let's say) float or int data in each matrix element.Then we
> saved the picture in .tiff format.There are only one directories in each
> tiff file.I have a simple question:how can I read the data of each pixels
> from the file?Because what I don't understand in libtiff is that I can
> read the file following the "scanline" method to a buf:
>
> buf = _TIFFmalloc(TIFFScanlineSize(Tif));
> for (int row = 0; row < ImageHeight; row++){
> TIFFReadScanline(Tif, buf, row);
> "reading the buff somehow";
> }
>
> but the problem is that I cannot get the single (let's say float or int
> type) datas of single pixels from the buff array.
Balint,
If the file has one sample per pixel and is of type float (4 bytes
per pixel, sampleformat ieeefloat) then you would do something like this:
buf = _TIFFmalloc(TIFFScanlineSize(Tif));
for (int row = 0; row < ImageHeight; row++){
TIFFReadScanline(Tif, buf, row);
"reading the buff somehow";
for( int pixel = 0; pixel < ImageWidth; pixel++ ) {
printf( "value[%d,%d] = %f\n",
pixel, row, ((float *) buf)[pixel] );
}
}
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
|
|||||||