[Solved]How to Solve cv2.applyColorMap Error

To solve this error, you have to first convert it into unit 8 and 255 and then turn back

        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)

Ranjeet Singh Rawat
Ranjeet Singh Rawat

Leave a Reply

Your email address will not be published.

ten + eight =