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

how to save 1 frame of registered depth image? [closed]

asked 2015-08-29 22:45:31 -0500

dmngu9 gravatar image

updated 2022-02-13 16:39:13 -0500

lucasw gravatar image

I tried modifying the image view nodes image_saver and extract_image but it still gives me error cant convert 16UC1 to BRG8. I want to save it in png type.

edit retag flag offensive reopen merge delete

Closed for the following reason OpenCV Question: THe OpenCV community prefers to answer questions at: http://answers.opencv.org/questions/ by tfoote
close date 2015-11-02 01:25:49.390787

1 Answer

Sort by ยป oldest newest most voted
3

answered 2015-08-31 04:45:05 -0500

Just use:

rosrun image_view image_saver image:=/camera/depth_registered/image_raw _encoding:=16UC1 _filename_format:="image%04i.png"

Get sure the topic is published. Maybe you need to activate registration with dynamic reconfiguration.

edit flag offensive delete link more

Comments

For reference for anyone else finding this, if the encoding is 32FC1 then this works (and using 16UC1 will produce blank images)

rosrun image_view image_saver image:=/camera/depth_registered/image_raw _encoding:=32FC1 _filename_format:="image%04i.tif"

tif is needed to save as a float, png will crush it down to 8-bit.

lucasw gravatar image lucasw  ( 2021-09-09 10:59:20 -0500 )edit

The specified encoding must of course match the data. When I wrote the answer 6 years ago, all sensors coded the depth with 2 bytes and thus the command above was correct for all /.../depth_registered/image_raw topcis. Unfortunately, I'm now in a completely different technological environment, but I'm a bit surprised that a sensor delivers 32FC1: In my time, only 11 to 12 (if I remember right) of the 16 bits were used, so there was still some space left.

MichaelKorn gravatar image MichaelKorn  ( 2021-09-09 14:37:22 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2015-08-29 22:45:31 -0500

Seen: 2,040 times

Last updated: Feb 13 '22