add online cloud reprojection
This commit is contained in:
+18
-13
@@ -60,12 +60,14 @@ Eigen::Matrix4d CloudReprojector::odomPoseToMatrix(const OdomPose& odom) const
|
||||
return T;
|
||||
}
|
||||
|
||||
cv::Mat CloudReprojector::reprojectCloud(const pcl::PointCloud<pcl::PointXYZRGB>& cloud_odom,
|
||||
const OdomPose& odom_pose)
|
||||
pcl::PointCloud<pcl::PointXYZRGB> CloudReprojector::transformCloudToCamera(
|
||||
const pcl::PointCloud<pcl::PointXYZRGB>& cloud_odom,
|
||||
const OdomPose& odom_pose) const
|
||||
{
|
||||
pcl::PointCloud<pcl::PointXYZRGB> cloud_in_cam;
|
||||
if (!initialized_)
|
||||
{
|
||||
return cv::Mat();
|
||||
return cloud_in_cam;
|
||||
}
|
||||
|
||||
// T_odom_imu: imu pose in odom frame
|
||||
@@ -80,9 +82,19 @@ cv::Mat CloudReprojector::reprojectCloud(const pcl::PointCloud<pcl::PointXYZRGB>
|
||||
// T_cam_odom: transforms points from odom frame to camera frame
|
||||
Eigen::Matrix4d T_cam_odom = T_cam_imu * T_imu_odom;
|
||||
|
||||
pcl::PointCloud<pcl::PointXYZRGB> cloud_in_cam;
|
||||
pcl::transformPointCloud(cloud_odom, cloud_in_cam, T_cam_odom);
|
||||
return cloud_in_cam;
|
||||
}
|
||||
|
||||
cv::Mat CloudReprojector::reprojectCloud(const pcl::PointCloud<pcl::PointXYZRGB>& cloud_odom,
|
||||
const OdomPose& odom_pose)
|
||||
{
|
||||
if (!initialized_)
|
||||
{
|
||||
return cv::Mat();
|
||||
}
|
||||
|
||||
pcl::PointCloud<pcl::PointXYZRGB> cloud_in_cam = transformCloudToCamera(cloud_odom, odom_pose);
|
||||
return projectCloudToImage(cloud_in_cam);
|
||||
}
|
||||
|
||||
@@ -94,14 +106,7 @@ cv::Mat CloudReprojector::reprojectCloudDepth(const pcl::PointCloud<pcl::PointXY
|
||||
return cv::Mat();
|
||||
}
|
||||
|
||||
Eigen::Matrix4d T_odom_imu = odomPoseToMatrix(odom_pose);
|
||||
Eigen::Matrix4d T_imu_odom = T_odom_imu.inverse();
|
||||
Eigen::Matrix4d T_cam_imu = extrinsic_params_.Tic.inverse();
|
||||
Eigen::Matrix4d T_cam_odom = T_cam_imu * T_imu_odom;
|
||||
|
||||
pcl::PointCloud<pcl::PointXYZRGB> cloud_in_cam;
|
||||
pcl::transformPointCloud(cloud_odom, cloud_in_cam, T_cam_odom);
|
||||
|
||||
pcl::PointCloud<pcl::PointXYZRGB> cloud_in_cam = transformCloudToCamera(cloud_odom, odom_pose);
|
||||
return projectCloudToImageDepth(cloud_in_cam);
|
||||
}
|
||||
|
||||
@@ -191,4 +196,4 @@ cv::Mat CloudReprojector::projectCloudToImageDepth(const pcl::PointCloud<pcl::Po
|
||||
}
|
||||
|
||||
return img;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user