@@ -103,6 +103,14 @@ cv::Mat EOD_ROS::getK(const sensor_msgs::CameraInfoConstPtr& info_msg){
103103 return K;
104104}
105105
106+ cv::Mat EOD_ROS::getD (const sensor_msgs::CameraInfoConstPtr& info_msg){
107+ cv::Mat D = cv::Mat::zeros (1 , 5 , CV_64F);
108+ for (size_t i=0 ; i<5 ; i++) {
109+ D.at <double >(0 ,i) = info_msg->D [i];
110+ }
111+ return D;
112+ }
113+
106114void EOD_ROS::rgb_info_cb (const sensor_msgs::ImageConstPtr& rgb_image, const sensor_msgs::CameraInfoConstPtr& rgb_info){
107115 ROS_INFO (" Get Image!" );
108116
@@ -122,7 +130,7 @@ void EOD_ROS::rgb_info_cb(const sensor_msgs::ImageConstPtr& rgb_image, const sen
122130 return ;
123131 }
124132
125- eod::InfoImage ii = eod::InfoImage (rgb, getK (rgb_info), cv::Mat ( ) );
133+ eod::InfoImage ii = eod::InfoImage (rgb, getK (rgb_info), getD (rgb_info ) );
126134 detect (ii, eod::InfoImage (), rgb_image->header );
127135 // detect(rgb, cv::Mat(), rgb_image->header);
128136}
@@ -157,7 +165,7 @@ void EOD_ROS::rgbd_info_cb(const sensor_msgs::ImageConstPtr& rgb_image, const se
157165 ROS_ERROR_THROTTLE (5 , " Depth image has unsupported encoding [%s]" , depth_image->encoding .c_str ());
158166 }
159167
160- eod::InfoImage ii_rgb = eod::InfoImage (rgb, getK (rgb_info), cv::Mat ( ) );
168+ eod::InfoImage ii_rgb = eod::InfoImage (rgb, getK (rgb_info), getD (rgb_info ) );
161169 eod::InfoImage ii_depth = eod::InfoImage (depth, getK (depth_info), cv::Mat () );
162170
163171 detect (ii_rgb, ii_depth, rgb_image->header );
0 commit comments