Saturday, 26 March 2011

Program for spatial correlogram of an image, in C

This program will read an image, convert it to greyscale, crop it to a square, and calculate it's spatial (1D) autocorrelation function (correlogram), printing it to screen.

It uses OpenCV image processing libraries - see here and here

Compilation instructions (in Ubuntu):

 sudo apt-get install libcv-dev libcv1 libcvaux-dev libcvaux1 libhighgui-dev libhighgui1  
pkg-config --libs opencv; pkg-config --cflags opencv
gcc `pkg-config --cflags --libs opencv` -o Rspat Rspat.c

Usage in the terminal:

 ./Rspat IMG_0208.JPG   

The program:

1 comment:

JP said...

Your piece of code seems interesting, but unfortunally, the copy-paste seems to have scrambled some line of the C code. Is it possible for you to change that back ?