Ask Your Question
0

Image encoding problem

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

apalomer gravatar image

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.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

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

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

Comments

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 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

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

Seen: 819 times

Last updated: Jul 04 '16