使用cv2.applyColorMap报错

需要把image转为255以及uint8,然后再转回去即可。

        real_image = cv2.cvtColor(real_image,cv2.COLOR_GRAY2RGB)
        real_image = cv2.resize(real_image,(256,256))
        real_image *= 255
        real_image = real_image.astype(np.uint8)
        real_image = cv2.applyColorMap(real_image, cv2.COLORMAP_HOT)
        real_image = np.asarray(real_image/255, dtype=np.float32)

你可能感兴趣的:(python)