A simple example program using OpenCV 2.3 that calculates a histogram of the pixels in an image in a not-terribly-efficient manner.
Install OpenCV 2.3.1 on your machine.
$ make
$ ./hist
All tests passed
The code should also compile with Visual Studio, if you prefer, although this is currently untested (please report any problems).