简体   繁体   English

如何为多张图像设置相同的亮度?

[英]How to set same luminance for several images?

I have a lot of images with different luminance value. 我有很多具有不同亮度值的图像。 And i want to set luminance of image to standard value that is 0,196 or 49,98. 我想将图像的亮度设置为0,196或49,98的标准值。

And what i want is: 我想要的是:

  • image that has overexposure the luminance should be decrease, and 过度曝光的图像应降低亮度,并且
  • image that has under-exposure, the luminance should be increase. 曝光不足的图像,应提高亮度。

标准图像 过度曝光 曝光不足

Image 1 - standard image, Image 2 - Over-exposure, Image 3 - Under-exposure 图像1-标准图像,图像2-曝光过度,图像3-曝光不足

The question is "how to set all of images has a exposure/luminance same like a standard image?" 问题是“如何设置所有图像的曝光/亮度与标准图像相同?”

So, I think there are two questions, you are asking. 所以,我想您有两个问题。

Q1: Q1:

And what i want is: 我想要的是:

  • image that has overexposure the luminance should be decrease, and 过度曝光的图像应降低亮度,并且
  • image that has under-exposure, the luminance should be increase. 曝光不足的图像,应提高亮度。

I believe what you are looking for is some sort of histogram equalization . 我相信您正在寻找的是某种直方图均衡化

If you plot the histograms of those three images, they would look something like this: 如果您绘制这三个图像的直方图,它们将看起来像这样:

直方图

As you can see, 如你看到的,

  • the distribution of the underexposed histogram is more concentrated in the lower bins, roughly [0 ~ 55] . 曝光不足的直方图的分布更多地集中在下部区域, roughly [0 ~ 55]

  • the distribution of the overexposed histogram is more concentrated in the higher bins, roughly [55 ~ 225] . 曝光过度的直方图的分布更集中在较高的箱中, roughly [55 ~ 225]

  • the distribution of your 'standard' histogram is more concentrated in the in-between bins, roughly [15 ~ 145] . 您的 “标准”直方图的分布更多地集中在两个框之间, roughly [15 ~ 145]

What you want to do is distribute the histograms more equally among all bins. 您要做的是将直方图更均匀地分布在所有垃圾箱中。 You could try to come up with a little algorithm of your own or you could use the built-in MATLAB function adapthisteq() as explained here , on how to use. 你可以尝试拿出自己的一点点的算法或者你可以使用内置的MATLAB功能adapthisteq()作为解释在这里 ,如何使用。 Playing with the different parameters, you could end up with a histogram distribution that produces the best image output for you. 使用不同的参数,最终可能会得到直方图分布,从而为您提供最佳的图像输出。 By default, the function adapthisteq would try to distribute the histogram over all 256 bins. 默认情况下,功能adapthisteq将尝试将直方图分布在所有256个仓中。

Q2: Q2:

The question is "how to set all of images has a exposure/luminance same like a standard image?" 问题是“如何设置所有图像的曝光/亮度与标准图像相同?”

If you just want the histograms of the other two images to look like your 'standard' image, for that you could use the imhistmatchn function as explained here . 如果你只是想其他两个图像的直方图看起来像你的 “标准”的图像,为您可以使用imhistmatchn功能解释在这里 to be honest, I have little experience with this function myself, but you could try it out. 老实说,我自己对此功能的经验很少,但是您可以尝试一下。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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