AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2010.02.08 10:47 "[Tiff] fftw and TIFF files", by
2010.02.08 16:48 "Re: [Tiff] fftw and TIFF files", by Bob Friesenhahn
2010.02.08 17:43 "[Tiff] OpenImageIO; was Re: fftw and TIFF files", by Larry Gritz
2010.02.08 21:39 "[Tiff] FFT on two TIFF images", by Richard Nolde
2010.02.08 23:05 "Re: [Tiff] FFT on two TIFF images", by Andy Cave
[...]

2010.02.08 21:39 "[Tiff] FFT on two TIFF images", by Richard Nolde

Deborah,
    Either you are making lots of assumptions about TIFF images or your

needs are very restricted. Here are a few things to consider if you want to use LIBTIFF.

  1. G3/G4 Faxes are encoded with 8 samples per byte before compression, not 8 eight bits per sample so you have to extract a single sample from each byte with bit masks and shifts and then promote that bit to a double. LIBTIFF will handle the encode/decode of the compressed data stream into your buffer, but then you have to extract the samples from that packed buffer into a much larger buffer. Tiffcrop contains code that extracts single bits from the G3/G4 decoded buffer if you want to look at it. Promoting the values to double would just be a matter of casting the returned samples as you copy them into your complex buffer from the default buffer returned to your application by LibTIFF.
  2. Fourier Transforms only work if the width of the sample is a power of two, which is pretty unlikely to be the case with faxes. You will need to pad each line out to a power of two with zeros before processing your data with an FFT.
  3. If both images are of different sizes, you may need to compare only the parts that overlap, which could require some knowledge of the individual images to determine which parts to extract.
  4. Faxes from physical fax machines (they do still exist) are often skewed and this may effect the accuracy of your results.
  5. It has been a long time since I wrote an FFT, so I'm not too sure about this next comment. You may want to check if there is any value in doing an FFT on bilevel images. I think it is more common to do FFTs on grayscale images where the rate of transition from light to dark can vary over a wide area instead of being a simple on/off transition.
  6. A fellow developer in Germany has recommended Libfreeimage as a good way to get access to TIFF files using LibTiff. On Fedora, the RPMs are called freeimage and freeimage-devel. I don't know which TIFF formats it supports and what level of access it provides, but it might be worth a check.

Richard Nolde

Tiffcrop author.