简体   繁体   English

如何使用 python 中的 openCV 使图像中的照明均匀,或如何增强非均匀照明图像中的照明

[英]How to make uniform illumination in a image using openCV in python or how to enhance illumination in non-uniformly illuminated image

I have an image to segment but illumination is non-uniform.我有要分割的图像,但照明不均匀。 So, how do I make it uniform to segment the image.那么,如何使其统一分割图像。

You can use adaptive equalization algorithm such as CLAHE .您可以使用CLAHE等自适应均衡算法。 Here is a minimal working example:这是一个最小的工作示例:

import cv2

image = cv2.imread('original.jpg')
clahe = cv2.createCLAHE(clipLimit=2.0, tileGridSize=(8,8))
b = clahe.apply(image[:, :, 0])
g = clahe.apply(image[:, :, 1])
r = clahe.apply(image[:, :, 2])
equalized = np.dstack((b, g, r))
cv2.imwrite('equalized.jpg', equalized) 

在此处输入图像描述

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

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