如何在OpenCV + Visual C ++中测量对比度 [英] How To Measure Contrast in OpenCV + Visual C++

查看:168
本文介绍了如何在OpenCV + Visual C ++中测量对比度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题是以前的如何选择最好的对比度在OpenCV的图像,但根据@ Rook的建议,我改变它。



我要去对我的项目使用OpenCV + Visual Studio 2010。我只是想知道OpenCV如何使这更容易为我。我从视频中提取了大约一千帧,我需要找出哪一个具有最好的对比度。最好的,我认为质量之间的最高和最低的对比度。



我一直在网上搜索参考代码,但到目前为止,我还没有找到。



更新:所以基本上,我需要测量的对比度和比较图像之间的值。顺便说一句,这是一个通过望远镜观察火星的视频,我将使用从它提取的帧。

解决方案

图像的熵用作对比度的度量。请参阅此代码


熵是一个标量值,可用于表征输入图像纹理的随机性的统计测量。熵定义为

  -sum(p。* log2(p))



其中 p 包含直方图计数。


- Matlab文档


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

这篇关于如何在OpenCV + Visual C ++中测量对比度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆