How to measure contrast in OpenCV + Visual C ++

The question was earlier "How to choose the best contrast image in OpenCV", but as suggested by @Rook I am changing it.

I am going to use OpenCV + Visual Studio 2010 in my project. I just want to know how OpenCV can make this easier for me. I extracted about a thousand frames from the video, and I need to find out which one has the best contrast. At best, I find quality between the highest and the lowest contrast.

I searched the Internet for link codes, but so far I have not found it.

UPDATE: Basically, I need to measure contrast and compare values ​​between images. By the way, this is a video of observations on Mars through a telescope, and I'm going to use the frames extracted from it.

+7
source share
1 answer

Image entropy is used as a measure of contrast. See the code .

Entropy is a scalar value, a statistical measure of randomness that can be used to characterize the texture of an input image. Entropy is defined as

-sum(p.*log2(p)) 

where p contains the number of histograms.

- Matlab Documentation

+4
source

All Articles