Ask Your Question

Images from fisheye camera are displayed correctly with BGR8 encoding but not with MONO8

asked 2018-04-22 04:45:13 -0500

tuandl gravatar image

Hi, I want to output grayscale images from a fisheye camera (FOV < 180 degree). I understand that ROS currently doesn't support fisheye distortion models. However, I see that if I use a BGR8 image encoding (by setting sensor_msgs::image_encodings::BGR8), I can still get a "normal" distorted image, like this: normal_BGR8.

But if I change to MONO8 encodings, the image is unusable: weird_MONO8

These 2 images were captured with my camera firmly attached to the table. So I don't understand why I can get a "normal" color image but not a grayscale one?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-04-22 13:24:26 -0500

Hi There,

The problem here is that the encoding you are setting doesn't actually control the image content it only describes what's there. In the case of your first image it is being stored in 8 bit BGR encoding so with that specified it looks as it should.

In the case of the second image you've set the encoding to Mono 8 but the data of the image hasn't changed, as a result we are only seeing the leftmost third of the image. In this image each horizontal group of 3 grey pixels intensities are representing the blue, green and red components of the original image.

It's possible that the camera node you're using cannot produce grey scale images directly. In that case you can make a simple node that receives color images converts them to grey scale using OpenCV and publishes them again.

I have worked with wide and fish-eye lenses quite a bit in ROS, I use the OpenCV fish-eye functions directly.

Hope this helps.

edit flag offensive delete link more


@PeterBlackerThe3rd: you are correct. I figured out that my camera needs to be set in gray_scale_mode to output grayscale images, otherwise, it will output color. Thanks for your clarification!

tuandl gravatar image tuandl  ( 2018-04-22 14:40:14 -0500 )edit

No problem, glad you got it working.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2018-04-22 16:23:47 -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



Asked: 2018-04-22 04:45:13 -0500

Seen: 267 times

Last updated: Apr 22 '18