| 94 | RosBaseDataProvider::~RosBaseDataProvider() {} |
| 95 | |
| 96 | cv::Mat RosBaseDataProvider::readRosImage( |
| 97 | const sensor_msgs::ImageConstPtr& img_msg) const { |
| 98 | cv_bridge::CvImagePtr cv_ptr; |
| 99 | try { |
| 100 | cv_ptr = cv_bridge::toCvCopy(img_msg); |
| 101 | } catch (cv_bridge::Exception& exception) { |
| 102 | ROS_FATAL("cv_bridge exception: %s", exception.what()); |
| 103 | ros::shutdown(); |
| 104 | } |
| 105 | |
| 106 | if (img_msg->encoding == sensor_msgs::image_encodings::BGR8) { |
| 107 | LOG(WARNING) << "Converting image..."; |
| 108 | cv::cvtColor(cv_ptr->image, cv_ptr->image, cv::COLOR_BGR2GRAY); |
| 109 | } else { |
| 110 | CHECK_EQ(cv_ptr->encoding, sensor_msgs::image_encodings::MONO8) |
| 111 | << "Expected image with MONO8 or BGR8 encoding."; |
| 112 | } |
| 113 | |
| 114 | return cv_ptr->image; |
| 115 | } |
| 116 | |
| 117 | cv::Mat RosBaseDataProvider::readRosDepthImage( |
| 118 | const sensor_msgs::ImageConstPtr& img_msg) const { |
nothing calls this directly
no outgoing calls
no test coverage detected