AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2009.04.28 18:15 "[Tiff] Libtiff and OpenCV", by Andreas H.
2009.04.28 19:05 "Re: [Tiff] Libtiff and OpenCV", by Frank Warmerdam
2009.04.28 20:33 "Re: [Tiff] Libtiff and OpenCV", by Andreas H.
2009.04.29 02:32 "Re: [Tiff] Libtiff and OpenCV", by Kai-Uwe Behrmann
2009.04.29 07:37 "Re: [Tiff] Libtiff and OpenCV", by Andreas Heindl
2009.04.29 08:48 "Re: [Tiff] Libtiff and OpenCV", by Kai-Uwe Behrmann
2009.04.29 16:07 "Re: [Tiff] Libtiff and OpenCV", by Bob Friesenhahn

2009.04.28 19:05 "Re: [Tiff] Libtiff and OpenCV", by Frank Warmerdam

I'm stuck and I hope some of you can give me an advise. I use libtiff because opencv cannot read my source tif images.

My original image is stored in img. I use the code snipped beneath for converting the imageData (char buffer) to a uint8 buffer named TIFFImageData

     for (int x = 0; x < w; x++) {
            // printf("loop...%d to %d\n",count++,w);
            for (int y = 0; y < h; y++) {

                TIFFImageData[h * x + y] =  (uint8) img->imageData[h *

x + y]; // Copy data from ipl to tif
            }

        }

Andreas,

TIFF images are normally (always?) stored with a row of values together, followed by the next row, etc. So the above would need to have x and y reversed in handling. Something like:

    TIFFImageData[x + y*w] =  (uint8) img->imageData[h * x + y];

If you get this wrong, your images will be bizzarely skewed. I'm assuming your interpretation of your source buffer is correct.

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