简体   繁体   中英

How To Measure Contrast in OpenCV + Visual C++

The question was previously "How to select image of best contrast in OpenCV" but as per @Rook's suggestion, I'm changing it.

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

I have been searching the web for reference codes but so far, I haven't found one.

UPDATE: So basically, I need to measure the contrast and compare values between the images. By the way, this is a video of a Mars Observation via a telescope and I'm gonna be using the frames extracted from it.

Entropy of image is used as a measure of contrast. See this code .

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

 -sum(p.*log2(p)) 

where p contains the histogram counts.

Matlab documentation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM