PDA

View Full Version : Histogram of colour levels



kiock
04-24-2006, 11:41 AM
How could I produce a histogram of the grey levels in an image?

I would like to be able to get a .bmp image, put it into my program and then have that give me the grey levels of each pixel.

I could then put this data into Excel and produce a Histogram of it.

Can anyone tell/guide me to how I could get the data for each pixel?

Any help is much appreciated, thanks in advance!

zeoverlord
04-24-2006, 12:02 PM
glReadPixels will do nicely, but you don't need openGL to do this job, it can be done by just loading the bmp and directly getting the histogram data from the image data.

alternatively use the GL_EXT_histogram extention
http://oss.sgi.com/projects/ogl-sample/registry/EXT/histogram.txt

kiock
04-24-2006, 01:14 PM
Thanks so much for such a quick reply!

I'm having some compiler trouble atm so I will try it out later.

Thanks again!