00001
00024 #ifndef RGBDTOOLS_RGBD_UTIL_H
00025 #define RGBDTOOLS_RGBD_UTIL_H
00026
00027 #include <pcl/point_types.h>
00028 #include <pcl/point_cloud.h>
00029 #include <pcl/filters/voxel_grid.h>
00030 #include <opencv2/opencv.hpp>
00031
00032 #include "rgbdtools/types.h"
00033
00034 namespace rgbdtools {
00035
00046 enum DepthFitMode {
00047 DEPTH_FIT_LINEAR,
00048 DEPTH_FIT_LINEAR_ZERO,
00049 DEPTH_FIT_QUADRATIC,
00050 DEPTH_FIT_QUADRATIC_ZERO
00051 };
00052 Eigen::Matrix4d m4dfromPose(Pose pose);
00053 Pose AffineFromTRPY(double xoffset,double yoffset,double zoffset, double roll,double pitch,double yaw );
00061 void removeInvalidMeans(
00062 const Vector3fVector& means,
00063 const BoolVector& valid,
00064 Vector3fVector& means_f);
00065
00075 void removeInvalidDistributions(
00076 const Vector3fVector& means,
00077 const Matrix3fVector& covariances,
00078 const BoolVector& valid,
00079 Vector3fVector& means_f,
00080 Matrix3fVector& covariances_f);
00081
00087 void transformMeans(
00088 Vector3fVector& means,
00089 const AffineTransform& transform);
00090
00097 void transformDistributions(
00098 Vector3fVector& means,
00099 Matrix3fVector& covariances,
00100 const AffineTransform& transform);
00101
00108 void pointCloudFromMeans(
00109 const Vector3fVector& means,
00110 PointCloudFeature& cloud);
00111
00126 void buildRegisteredDepthImage(
00127 const cv::Mat& intr_rect_ir,
00128 const cv::Mat& intr_rect_rgb,
00129 const cv::Mat& ir2rgb,
00130 const cv::Mat& depth_img_rect,
00131 cv::Mat& depth_img_rect_reg);
00132
00139 void buildPointCloud(
00140 const cv::Mat& depth_img_rect,
00141 const cv::Mat& intr_rect_ir,
00142 PointCloudT& cloud);
00143
00154 void buildPointCloud(
00155 const cv::Mat& depth_img_rect_reg,
00156 const cv::Mat& rgb_img_rect,
00157 const cv::Mat& intr_rect_rgb,
00158 PointCloudT& cloud);
00159
00166 void depthImageFloatTo16bit(
00167 const cv::Mat& depth_image_in,
00168 cv::Mat& depth_image_out);
00169
00170 void eigenAffineToOpenCVRt(
00171 const AffineTransform& transform,
00172 cv::Mat& R,
00173 cv::Mat& t);
00174
00175 void openCVRtToEigenAffine(
00176 const cv::Mat& R,
00177 const cv::Mat& t,
00178 AffineTransform& eigen_affine);
00179
00180 void eigenAffineToXYZRPY(
00181 const AffineTransform& transform,
00182 float& x, float& y, float& z,
00183 float& roll, float& pitch, float& yaw);
00184
00185 void XYZRPYToEigenAffine(
00186 float x, float y, float z,
00187 float roll, float pitch, float yaw,
00188 AffineTransform& t);
00189
00190 void getTfDifference(
00191 const AffineTransform& transform,
00192 double& dist, double& angle);
00193
00205 void unwarpDepthImage(
00206 cv::Mat& depth_img_in,
00207 const cv::Mat& coeff0,
00208 const cv::Mat& coeff1,
00209 const cv::Mat& coeff2,
00210 int fit_mode=DEPTH_FIT_QUADRATIC);
00211
00212 void setRPY(
00213 float roll, float pitch, float yaw,
00214 Matrix3f& m);
00215
00216 }
00217
00218 #endif // RGBDTOOLS_RGBD_UTIL_H