You need to convert the image to 255 and uint8, 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)
Read More:
- How to Solve Opencv Reads Video Error: cv2.error
- CV: How to extracts the part of the picture with the specified color
- [Solved] cv2.error: (-215:Assertion failed) encoder->isFormatSupported(CV_8U) in function ‘imwrite_‘
- [Solved] cv2.xfeatures2d.SIFT_create() Error: module ‘cv2.cv2’ has no attribute ‘xfeatures2d’
- Opencv: How to Draw Palette
- [Solved] error: (-215:Assertion failed) !_src.empty() in function ‘cv::cvtColor‘
- [Solved] cv2.error: OpenCV(4.5.3) :-1: error: (-5:Bad argument) in function ‘circle‘
- How to Solve Python picamera and raspistill error
- How to Solve paddleOCR recognition of curved text Error
- How to Solve Pytorch eval Stuck Error
- How to Solve Pychart configuration import torch error
- How to Solve Python Importerror: DLL load failed: unable to find the specified program using tensorflow
- How to Solve pycharm terminal Failed to switch to virtual environment
- PyCharm: How to Solve Tensorflow_datasets Import Error
- How to Solve Turtle_tf Error in ROS
- How to Solve Automatic error keyerror:***‘
- How to Solve Spyder Version incompatible error
- How to Solve keras load_model() Error
- How to Solve ModuleNotFoundError Error After pip-autoremove Installed