【发布时间】:2014-02-03 20:05:26
【问题描述】:
需要对图像的颜色通道进行一些快速转换。
1)我已经将相应的输出值存储在一个列表中:
ListaVred = [0]*255
for i in range(0,255):
ListaVred[i]=i*127 / 255 + 128
2)我从图像中得到0到255的颜色输入值
3) 应该用输出替换图像中的输入值
i.e. red[45]= 0
ListaVred0] = 128
red[45]= 128
我查看了 cv2.LUT(src,dst) 函数,但不确定它的用途, http://docs.opencv.org/trunk/modules/core/doc/operations_on_arrays.html#cv2.LUT
cv2.LUT(ListaVred,red)
TypeError: src is not a numpy array, neither a scalar
ListaVred = np.array(ListaVred)
cv2.LUT(ListaVred,red)
cv2.error: /build/opencv-Ai8DTy/opencv-2.4.6.1+dfsg/modules/core/src/convert.cpp:1195: error: (-215) (lutcn == cn || lutcn == 1) && lut.total() == 256 && lut.isContinuous() && (src.depth() == CV_8U || src.depth() == CV_8S) in function LUT
【问题讨论】: