Open lucasjinreal opened 6 years ago
@jinfagang Have you solved it ? I'm also confusing.
I got same problem, has anyone solved it or figured out why this happened?
I got same problem .....
_OpenCV Error: Assertion failed ((lutcn == cn || lutcn == 1) && lut.total() == 256 && lut.isContinuous() && (src.depth() == CV_8U || src.depth() == CV_8S)) in LUT, file /home/firefly/cnn/opencv-2.4.13/modules/core/src/convert.cpp, line 1215
Traceback (most recent call last):
File "./test_segmentation.py", line 69, in
@wzhouuu @jinfagang for me, --colour input img should be 1 channel? can using the default ENet/scripts/cityscapes19.png try
I have met the same problem. And I have solved it. For me, the order of the last two input params is wrong. After exchanging them, the code is passed successfully.
I met the same problem. The codes is def apply_custom_colormap(image_gray, cmap=None): assert image_gray.dtype == np.uint8, 'must be np.uint8 image' if image_gray.ndim == 3: image_gray = image_gray.squeeze(-1)
sm = plt.cm.ScalarMappable(cmap=cmap)
# Obtain linear color range
color_range = sm.to_rgba(np.linspace(0., 1., 255))[:, 0:3] # color range RGBA => RGB
color_range = (color_range*255.0).astype(np.uint8) # [0,1] => [0,255]
# color_range = np.squeeze(np.dstack([color_range[:,2], color_range[:,1], color_range[:,0]]), 0) # RGB => BGR
# Apply colormap for each channel individually
channels = [cv2.LUT(image_gray, color_range[:, i]) for i in range(3)]
return np.dstack(channels)
Here, color_range = sm.to_rgba(np.linspace(0., 1., 255))[:, 0:3] is changed to color_range = sm.to_rgba(np.linspace(0., 1., 256))[:, 0:3] It work!
I have met this error yet. For me, the cv image was saved as float and value scope was (0.0, 255.0). After astype(np.uint8), it works.
convert into .astype("uint8")
the order of parameters is wrong kindly change it
I kick it quick start by using the trained model provide in model zoo, but there is an opencv error, really confusing:
Any possiable reason for this?