image_saver and image_viewer have different images.

asked 2020-08-26 16:53:38 -0500

Chao Chen gravatar image

updated 2022-10-30 09:31:23 -0500

lucasw gravatar image

I was trying to use Gazebo inbuilt kinect camera to take depth image for robot. However, all the photos saved using image_saver are quite dim. However, if I try to view the depth image using rosrun image_viewer image_viewer. Everything looks ok. The photos are attached below. Can anyone explain why and how to fix it?

image_viewer

image description

image_saver:(Very dark, but not completely black, you can see the shape of the robot from certain angle) image description

command: rosrun image_view image_saver image:=/camera/depth/image_raw_throttle _encoding:=16UC1 _filename_format:="image%04i.png"

edit retag flag offensive close merge delete

Comments

This might be a problem of the image being float (range 0-1) or int (0-255). It looks like you have to convert the image from float to int to display it correctly. I am not sure though if this is the solution, just a guess.

rfn123 gravatar image rfn123  ( 2020-08-27 03:54:33 -0500 )edit

The pixel ranges from 0 to 255. Below is some sample pixel value.\

237, 90, 207, 63, 237, 90, 207, 63, 237, 90, 207, 63, 237, 90, 207, 63, 237, 90, 207, 63, 237, 90, 207, 63, 237, 90, 207, 63, 237, 90, 207, 63, 237, 90, 207, 63, 237, 90, 207, 63, 237, 90, 207, 63, 237, 90, 207, 63, 237, 90, 207, 63, 237, 90, 207, 63, 237, 90, 207, 63, 237, 90, 207, 63, 237, 90, 207, 63, 237, 90, 207, 63, 237, 90, 207, 63, 237, 90, 207, 63, 237, 90, 207, 63, 237, 90, 207, 63, 237, 90, 207, 63, 237, 90, 207, 63, 237, 90, 207, 63, 237, 90, 207, 63, 237, 90, 207, 63, 237, 90, 207, 63, 237, 90, 207, 63, 237, 90, 207, 63, 237, 90, 207, 63, 237, 90, 207, 63, 237, 90, 207, 63, 237, 90, 207, 63, 237 ...
(more)
Chao Chen gravatar image Chao Chen  ( 2020-08-28 01:00:53 -0500 )edit

Could also be because your depth image is saved in 16 bit (16UC1), thus the range is 0-65535. This would explain why your image is very dark,since values like 207 or 90 are only 0.3 percent of the whole brightness range. You could try to normalize the image to the correct range to display it correctly

rfn123 gravatar image rfn123  ( 2020-08-28 10:18:20 -0500 )edit