toby, the get_histo_range might do what you want but they are quite different from what you are asking (getting the contrast level without focusing or shutter action)
At the VERY contrary, those commands get information about the histogram of the last image that was shot (i.e. after you have focused, meterd, shot etc.etc.)
What you need requires reading the live preview buffer and operating on that.
The giet_histo_range function operates on the RAW buffer; I have made it like this because I needed to get info about very dark scenes, and the live preview screen was completely black, while the RAW buffer (with a long enough exposure) would contain an image.
You should explain better what you want to achieve, I think that you could get some result playing with the motion detect routines, that work by dividing the live preview in little squares and monitoring changes of brightness within each single square.
Would that help?