【发布时间】:2018-09-24 21:58:04
【问题描述】:
我正在寻找一种将自动白平衡应用于图像的简单方法。
我找到了一些关于balanceWhite() 方法的官方文档:cv::xphoto::WhiteBalancer Class Reference
但是,当我尝试调用示例中所示的函数时,我遇到了一个模糊的错误。
image = cv2.xphoto_WhiteBalancer.balanceWhite(image)
加注:
Traceback (most recent call last):
File "C:\Users\Delgan\main.py", line 80, in load
image = cv2.xphoto_WhiteBalancer.balanceWhite(image)
TypeError: descriptor 'balanceWhite' requires a 'cv2.xphoto_WhiteBalancer' object but received a 'numpy.ndarray'
如果那时我尝试根据需要使用cv2.xphoto_WhiteBalancer 对象:
balancer = cv2.xphoto_WhiteBalancer()
cv2.xphoto_WhiteBalancer.balanceWhite(balancer, image)
它引发:
Traceback (most recent call last):
File "C:\Users\Delgan\main.py", line 81, in load
cv2.xphoto_WhiteBalancer.balanceWhite(balancer, image)
TypeError: Incorrect type of self (must be 'xphoto_WhiteBalancer' or its derivative)
有没有人成功地在 Python 3.6 和 OpenCV 3.4 中使用此功能?
我也尝试使用派生类GrayworldWB、LearningBasedWB 和SimpleWB,但错误是一样的。
【问题讨论】:
标签: python python-3.x opencv image-processing opencv3.0