Ok, its a month later, but I wrote you a little bit of code (in python) for this ;)
(Assuming you are just after the image density histogram)
import cv
im2 = cv.LoadImage('ph05l.jpg')
width, height = cv.GetSize(im2)
hist = []
column_width = 1 # this allows you to speed up the result,
# at the expense of horizontal resolution. (higher is faster)
for x in xrange(width / column_width):
column = cv.GetSubRect(im2, (x * column_width, 0, column_width, height))
hist.append(sum(cv.Sum(column)) / 3)
To speed things up, you need'nt alter your image files, just alter the bin width of the sampling (column_width in the script), obviously you lose some resolution if you do this (as you can see in the image below).
In the image, I show the results (graphing hist) with your file, using column_width's of 1, 10 and 100. They ran for me at 0.11, 0.02 and 0.01 seconds respectively.
I wrote it in PIL too, but it runs around 5 to 10 times slower.
