Pythonで画像転送を行うためにcv2 LUTを使用しようとしています。LUT は、画像と同じ数のチャンネルを持つ必要があります。しかし、1 つのエラーを解決できません。
image1Transfered = cv2.LUT(image1, lut) cv2.error: /build/buildd/opencv-2.3.1/modules/core/src/convert.cpp:1037: エラー: (-215) (lutcn == cn || lutcn == 1) && lut.total() == 256 && lut.isContinuous() && (src.depth() == CV_8U || src.depth() == CV_8S) in function LUT
これがpythonコードです。画像を複数の単一チャンネルに分割し、それぞれLUTを適用できると思います。しかし、これは資源の無駄です。
#!/usr/bin/python
import sys
import cv2
import numpy as np
image1 = cv2.imread("../pic1.jpg", 1)
# apply look up table
lut = np.arange(255, -1, -1, dtype = image1.dtype )
lut = np.column_stack((lut, lut, lut))
image1Converted = cv2.LUT(image1, lut) # <-- this is where it fails
お時間をいただきありがとうございます。