Unsupported image encoding [64FC4]
Meranre opened this issue · 1 comments
Hi ^^ , i try to display a matrix of my depth map but i have an encoding problem with rviz , i even try with image_view : Unable to convert '64FC4' image for display: 'cv_bridge.cvtColorForDisplay() output encoding is empty and cannot be guessed.'
I use the function : ros_numpy.image.numpy_to_image(maDepth_map,'64FC4') for convert my matrix to image .
I don't know where is the problem and i'm stuck on this error , did i miss something ?
So if someone is interest X) , here the solution for solving the problem
image = (dupl * 255).round().astype(np.uint8)
im = bridge.cv2_to_imgmsg(image, encoding="mono8")
The problem is the encoding 64FC4 is not good for visualization , so i decide to take only 1 channel for my depth map , after you need to convert your matrix [0,1] to [0,255] (here uint8) , because Rviz don't like float32 data for image , you need to convert to rgb or mono .
OpenCV prefer data between 0 and 1 ( imshow )