ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Image encoding problem

asked 2016-07-04 12:54:47 -0600

apalomer gravatar image


I have a cv::Mat of depth CV_8UC1 (that I know for sure it is this since it what the camera streams). In the camera driver I can do cv::imshow and display this CV_8UC1 image and I see it right:

image description

In order to send it as a ros message, I use the sensor_msgs::image_encodings::MONO8 image encoding (I tryed with sensor_msgs::image_encodings::TYPE_8UC1 and I can not see the image using image_view nor with rviz, but I made a simple subscriber that susbscribes to the image, undecodes using the same image encoding that I used in the publisher and the result is the same as using mono8 and being able to visualize it using image_view package) and I get this image:

image description

Which is clearly not right. I dont know what do I need to do to convert this cv::Mat CV_8UC1 to a proper mono8 image for ros. Any help?


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-07-04 12:56:59 -0600

apalomer gravatar image

Ok, Just for testing I did something that I though would not be smart. I used sensor_msgs::image_encodings::RGB8 and now it works... Can somebody tell me why?

Thank you.

edit flag offensive delete link more


You can see my code, it's almost what you want to know. Right here.

random_enthusiast gravatar image random_enthusiast  ( 2020-08-07 18:51:02 -0600 )edit

Question Tools

1 follower


Asked: 2016-07-04 12:54:47 -0600

Seen: 1,700 times

Last updated: Jul 04 '16