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

问题描述 投票:0回答:1

我有一个要分割的图像,但照明不均匀。因此,如何均匀分割图像。

python opencv image-segmentation
1个回答
0
投票

您可以使用自适应均衡算法,例如CLAHE。这是一个最小的工作示例:

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) 

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.