使用Python调整基于直方图的曝光(亮度/对比度) [英] Adjusting exposure (brightness/contrast) based on histogram using Python

查看:1329
本文介绍了使用Python调整基于直方图的曝光(亮度/对比度)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试用Python制作一个带有GUI(最有可能使用Kivy)的程序,以匹配两个图像的曝光。我想要将两个图像(RGB或灰度)与它们相应的直方图并排显示,并且有一个滑块可以控制所选图像上的曝光。我想就如何解决这个问题提出一些建议。

I'm trying to make a program with a GUI (most likely using Kivy) in Python to match the exposure of two images. I want to display both images (RGB or grayscale) side by side with their corresponding histograms and have a slider to be able to control the exposure on the selected image. I would like some advise on how to go about this.

到目前为止,我已经阅读了几篇文章,似乎有几种方法来计算图像的直方图(numpy,matplotlib,openCV和PIL),但是我我很困惑哪个最好(安装最少的库/依赖项)让我实现。我还读过有关改变图像曝光的内容,有些人提到改变亮度和对比度,所以你需要改变两者来改变曝光?我知道openCV有equalizeHist但是它会自动完成,我想要的是两张图像尽可能接近整体曝光;这就是为什么我想手动做的原因。如果可以自动完成它会很棒,但我仍在考虑如何做到这一点。

So far I have read several posts and there seem to be several ways to approach calculating the histogram of an image (numpy, matplotlib, openCV, and PIL), however I'm confused about which would be best (least libraries/dependencies to install) for me to implement. I have also read about changing the exposure on an image and some people mention changing brightness and contrast, so you need to change both to change exposure? I know openCV has equalizeHist but that does it automatically and what I would like is for both images to have as close as possible overall exposure; that's why I was thinking of doing it manually. It would be great if could do it automatically, but I'm still thinking on how to do it.

我知道你们非常重视你的时间所以我如果你没有时间深入回答这个问题,我将会理解。

I know you guys place tremendous value on your time so I'll understand if you don't have time to answer this in depth.

推荐答案

我们在这里有一个直方图调整的例子: a href =http://scikit-image.org/docs/dev/auto_examples/plot_equalize.html#example-plot-equalize-py =nofollow> http://scikit-image.org/docs/ dev / auto_examples / plot_equalize.html#example-plot-equalize-py

We have an example of histogram adjustment here: http://scikit-image.org/docs/dev/auto_examples/plot_equalize.html#example-plot-equalize-py

听起来好像你对直方图匹配感兴趣。我在这里有一些代码,但它没有经过充分测试:

It sounds as though you are interested in histogram matching, though. I have some code for that purpose here, but it is not well tested:

https://github.com/stefanv/supreme/blob/master/supreme/photometry/register.py#L30

如果您确实发现该代码有用,请随意向scikit-image发出拉取请求,我们可以尝试将其集成到包中。

If you do find that code useful, feel free to make a pull request to scikit-image and we can try to integrate it into the package.

这篇关于使用Python调整基于直方图的曝光(亮度/对比度)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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