Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsupported image encoding [64FC4] #13

Closed
Meranre opened this issue May 9, 2019 · 1 comment
Closed

Unsupported image encoding [64FC4] #13

Meranre opened this issue May 9, 2019 · 1 comment

Comments

@Meranre
Copy link

Meranre commented May 9, 2019

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 ?

@Meranre
Copy link
Author

Meranre commented May 16, 2019

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 )

@Meranre Meranre closed this as completed May 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant