問題描述
我正在嘗試用 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.
推薦答案
我們有一個直方圖調整的例子 這里
We have an example of histogram adjustment here
不過,您似乎對直方圖匹配感興趣.我有一些用于此目的的代碼這里,但它沒有經過很好的測試.
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.
如果您確實發現該代碼有用,請隨時向 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.
編輯 2019-04-29: 直方圖匹配是 現在包含在 scikit-image 中.
這篇關于使用 Python 根據直方圖調整曝光(亮度/對比度)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!