Go to the documentation of this file.00001
00024 #ifndef CCNY_RGBD_RGBD_UTIL_H
00025 #define CCNY_RGBD_RGBD_UTIL_H
00026
00027 #include <ros/ros.h>
00028 #include <pcl/point_types.h>
00029 #include <pcl/point_cloud.h>
00030 #include <tf/transform_datatypes.h>
00031 #include <pcl/filters/voxel_grid.h>
00032 #include <opencv2/opencv.hpp>
00033
00034 #include "ccny_rgbd/types.h"
00035
00036 namespace ccny_rgbd {
00037
00045 void getTfDifference(const tf::Transform& motion, double& dist, double& angle);
00046
00056 void getTfDifference(
00057 const tf::Transform& a,
00058 const tf::Transform b,
00059 double& dist, double& angle);
00060
00068 bool tfGreaterThan(const tf::Transform& a, double dist, double angle);
00069
00074 tf::Transform tfFromEigen(Eigen::Matrix4f trans);
00075
00080 Eigen::Matrix4f eigenFromTf(const tf::Transform& tf);
00081
00089 void tfToEigenRt(
00090 const tf::Transform& tf,
00091 Matrix3f& R,
00092 Vector3f& t);
00093
00101 void tfToOpenCVRt(
00102 const tf::Transform& transform,
00103 cv::Mat& R,
00104 cv::Mat& t);
00105
00113 void openCVRtToTf(
00114 const cv::Mat& R,
00115 const cv::Mat& t,
00116 tf::Transform& transform);
00117
00128 void tfToXYZRPY(
00129 const tf::Transform& t,
00130 double& x, double& y, double& z,
00131 double& roll, double& pitch, double& yaw);
00132
00139 void convertCameraInfoToMats(
00140 const CameraInfoMsg::ConstPtr camera_info_msg,
00141 cv::Mat& intr,
00142 cv::Mat& dist);
00143
00150 void convertMatToCameraInfo(
00151 const cv::Mat& intr,
00152 CameraInfoMsg& camera_info_msg);
00153
00159 double getMsDuration(const ros::WallTime& start);
00160
00168 void removeInvalidMeans(
00169 const Vector3fVector& means,
00170 const BoolVector& valid,
00171 Vector3fVector& means_f);
00172
00182 void removeInvalidDistributions(
00183 const Vector3fVector& means,
00184 const Matrix3fVector& covariances,
00185 const BoolVector& valid,
00186 Vector3fVector& means_f,
00187 Matrix3fVector& covariances_f);
00188
00194 void transformMeans(
00195 Vector3fVector& means,
00196 const tf::Transform& transform);
00197
00204 void transformDistributions(
00205 Vector3fVector& means,
00206 Matrix3fVector& covariances,
00207 const tf::Transform& transform);
00208
00215 void pointCloudFromMeans(
00216 const Vector3fVector& means,
00217 PointCloudFeature& cloud);
00218
00233 void buildRegisteredDepthImage(
00234 const cv::Mat& intr_rect_ir,
00235 const cv::Mat& intr_rect_rgb,
00236 const cv::Mat& ir2rgb,
00237 const cv::Mat& depth_img_rect,
00238 cv::Mat& depth_img_rect_reg);
00239
00246 void buildPointCloud(
00247 const cv::Mat& depth_img_rect,
00248 const cv::Mat& intr_rect_ir,
00249 PointCloudT& cloud);
00250
00261 void buildPointCloud(
00262 const cv::Mat& depth_img_rect_reg,
00263 const cv::Mat& rgb_img_rect,
00264 const cv::Mat& intr_rect_rgb,
00265 PointCloudT& cloud);
00266
00273 void depthImageFloatTo16bit(
00274 const cv::Mat& depth_image_in,
00275 cv::Mat& depth_image_out);
00276
00277 }
00278
00279 #endif // CCNY_RGBD_RGBD_UTIL_H