8
$\begingroup$

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?

$\endgroup$
7
  • 2
    $\begingroup$ Can you clarify what you mean by a "global" image? $\endgroup$
    – jonsca
    Commented Sep 6, 2012 at 1:07
  • 1
    $\begingroup$ The whole image $\endgroup$ Commented Sep 6, 2012 at 8:54
  • 1
    $\begingroup$ mhnm i thought laplace is to calculate the sharpness. $\endgroup$ Commented Sep 6, 2012 at 19:07
  • 1
    $\begingroup$ 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. $\endgroup$
    – Libor
    Commented Sep 6, 2012 at 20:39
  • 2
    $\begingroup$ Standard deviation of pixel values is a good metric. $\endgroup$ Commented Oct 30, 2012 at 16:20

2 Answers 2

7
$\begingroup$

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 http://www.mathworks.ch/ch/help/images/ref/entropy.html

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

$\endgroup$
3
$\begingroup$

A simple way to calculate contrast is by computing the standard deviation of the greyed image pixel intensities.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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