From 47b35ed37284603cb8ce319d366e06bd756ac21c Mon Sep 17 00:00:00 2001 From: Alexander Kazeka Date: Tue, 21 Jan 2020 21:18:00 +0300 Subject: [PATCH] Convert image to BGR8 as expected by libsvo (https://github.com/uzh-rpg/rpg_svo_example/issues/51) --- svo_ros/src/svo_interface.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/svo_ros/src/svo_interface.cpp b/svo_ros/src/svo_interface.cpp index 660ea9d..fda14ac 100644 --- a/svo_ros/src/svo_interface.cpp +++ b/svo_ros/src/svo_interface.cpp @@ -195,7 +195,8 @@ void SvoInterface::monoCallback(const sensor_msgs::ImageConstPtr& msg) cv::Mat image; try { - image = cv_bridge::toCvCopy(msg)->image; + // convert image to BGR8 as expected by libsvo + image = cv_bridge::toCvShare(msg, sensor_msgs::image_encodings::BGR8)->image; } catch (cv_bridge::Exception& e) {