Prewhitening

Prewhitening Example

This example shows how cross-correlation is NOT necessarily the best way to estimate the position of an image-patch within an image.

The original image is top-left. The patch to be found is discoloured in the top-right image.

If the patch is cross-correlated directly with the original image (red plane only), then the resulting mess is shown in the bottom left.  Two problems are evident:

If a simple prewhitening is applied to both image and patch before cross-correlation, then both these problems are dramatically reduced. This is shown in the bottom right image. 

For these images, the "diff" operation in Matlab was all that was required for prewhitening.  Your mileage may vary, depending on the statistics of the original signal and the measurement mechanism.

The correct position is shown as the small red dot in the bottom right image.