2010.02.08 10:47 "[Tiff] fftw and TIFF files", by

2010.02.08 10:47 "[Tiff] fftw and TIFF files", by


I'm trying to do the phase correlation of two TIFF images (a reference image and an image received via fax) to determine if they are similar and or have any offset.

For this I'm using LibTIFF and FFTW. In order to do this I need to load the Image data to the FFTW input arrays:

fftw_complex *img1 = ( fftw_complex* )fftw_malloc( sizeof( fftw_complex ) * width * height ); <- this is the input array (it's a double[2] composed of the real and imaginary parts of a complex number)

As I said, what I need to do is load the image data on that input array. I would like to do something like this:

for( i = 0; i < height ; i++ ) {

    for( j = 0 ; j < width ; j++) {

        img1[k][0] = <- here goes the image data

        img1[k][1] = 0.0;



This kind of thing is what I've seen in an OpenCV example for reading TIFF images, but it doesn't seem to work so I decided to try with LibTIFF.

Thanks in advance,