0

Rosanswers logo

Hello

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?

Thanks.


Originally posted by apalomer on ROS Answers with karma: 318 on 2016-07-04

Post score: 0

1 Answers1

0

Rosanswers logo

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.


Originally posted by apalomer with karma: 318 on 2016-07-04

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by random_enthusiast on 2020-08-07:
You can see my code, it's almost what you want to know. Right here.