Computing Correlation Coefficients in Python

Published on 2007-12-05 08:59:00+00:00
Image   Python   numpy   pil  

A useful technique for matching objects in images is to compute the images' Correlation Coefficients. Essentially, you take any image and compute the correlation between it and another, smaller image containing ONLY the object that you want to identify. The resulting correlation image should contain bright spots where there is a high correlation (or match) between the two images.

Here's a simple python script to compute the correlation between two images:

https://github.com/bradmontgomery/correlation

It requires PIL and numpy, and it's fairly inefficient, but it's a simple, straightforward implementation.