Signal Processing Stack Exchange is a question and answer site for practitioners of the art and science of signal, image and video processing. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For a project, I want to measure the contrast of a global image.

I want to compare different images to get the image with the best contrast. I know about the Weber contrast, but I need a normalized contrast value (in the range between 0-1 or other).

Is there a simple method to do this in openCV?

share|improve this question
Can you clarify what you mean by a "global" image? – jonsca Sep 6 '12 at 1:07
The whole image – 501 - not implemented Sep 6 '12 at 8:54
mhnm i thought laplace is to calculate the sharpness. – 501 - not implemented Sep 6 '12 at 19:07
I have seen using Laplace in context of "local contrast". There are many definitions. It depends greatly on your application. For example, you can measure just color contrast of every pixel (distance from gray) or you can measure differences in neighboring pixels, or get some measurement from histogram, or take contrast as difference between darkest and lightest point in the image. – Libor Sep 6 '12 at 20:39
Standard deviation of pixel values is a good metric. – Andrey Rubshtein Oct 30 '12 at 16:20

One simple way for quantification of contract that I can think of is through use of image histogram. Following is my suggestion

  1. Compute Histogram of the Image
  2. From the counts compute entropy

If you just want to try it out you can use the matlab inbuilt function

You can use the entropy value of the histogram as a measure of contract.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.