Ros2 : how to process stereo images (stereo_image_proc?)
Hi,
I'm trying to do the basic stereo image preprocessing in ROS2 : undistorting the images and doing rectification (and if possible go to monocrom in the process). Afterwards, I'm planing to process the undistorted-rectified-monochrome image pairs in opencv (nb : if need be, I can start with image colors and pass to monochrome in opencv)
If I'm not mistaken, in ROS1, this could be easely done with the stereoimageproc package.
But how to do so in ROS2? I have seen that there is still a stereoimageproc package in ROS2, but I haven't found any documentation/tutorials/examples yet.
Is this package ready to use yet? If so, do you have any ressources on how to use it? Or can you suggest any better alternative (if needed, I can update to galactic or rolling)?
What I have tried so far :
So far, I have the sensormsgs/Image and the sensormsgs/CameraInfo for left and right from an old (ie ROS1) bag file read with:
ros2 bag play -s rosbag_v2 ./pyramide2_indexed.bag
when doing a rostopic list, I get (restricted to relevant topics) :
$ ros2 topic list -t
/stereo/left/camera_info [sensor_msgs/msg/CameraInfo]
/stereo/left/image_raw [sensor_msgs/msg/Image]
/stereo/right/camera_info [sensor_msgs/msg/CameraInfo]
/stereo/right/image_raw [sensor_msgs/msg/Image]
then I try to launch the stereoimageproc inspiring myself from http://wiki.ros.org/stereo_image_proc/Tutorials/ChoosingGoodStereoParameters :
$ ROS_NAMESPACE=stereo ros2 run stereo_image_proc disparity_node
NB : the stereoimageproc node seems to have disappeared, so I try with disparitynode (and with pointcloudnode), the only two nodes available. I also tried by removing "ROSNAMESPACE=stereo".
When I then run rostopic list again, I get (limited to relevant topics) :
ros2 topic list -t
/disparity [stereo_msgs/msg/DisparityImage]
/imu/data [sensor_msgs/msg/Imu]
/imu/mag [sensor_msgs/msg/MagneticField]
/left/camera_info [sensor_msgs/msg/CameraInfo]
/left/image_rect [sensor_msgs/msg/Image]
/parameter_events [rcl_interfaces/msg/ParameterEvent]
/right/camera_info [sensor_msgs/msg/CameraInfo]
/right/image_rect [sensor_msgs/msg/Image]
/rosout [rcl_interfaces/msg/Log]
/stereo/left/camera_info [sensor_msgs/msg/CameraInfo]
/stereo/left/image_raw [sensor_msgs/msg/Image]
/stereo/right/camera_info [sensor_msgs/msg/CameraInfo]
/stereo/right/image_raw [sensor_msgs/msg/Image]
However, when I try to run image_view (or rostopic hz) on any of the resulting images/topics, I get no result (and I would expect the resulting topics to be in /stereo/*).
So I'm using it wrong?
Or should I use a core node ("stereoimageproc") that is not yet ported to foxy? Or might it be a problem with using messages coming from a ros1 bag?
Do you have any alternatives to suggest to do the stereo processing?
If it helps, I can upgrade to galactic or to rolling (I was planning to wait for 2 more weeks to install Humble when it is released, but I can already update if it helps)
EDIT :
after more digging arround,it seems that in ROS1, there was an "stereoimageproc" node in stereoimageproc package that did what I wanted (at least the undistortion part, I'm not 100% sure about the stereo rectification part), but this node has disapeared from the "stereoimageproc" package in ROS2 (it is neither in foxy, nor in rolling, nor have I seen it in the pull requests). Is it simply that it hasn't been ported yet to ROS2, or is there now another "normal" way to do stereo undistortion/rectification now?
Thanks a lot in advance
Felix
Asked by felixn on 2022-05-12 05:38:52 UTC
Comments