From aec230d0d076d4da7f4848e9682384f360d59d25 Mon Sep 17 00:00:00 2001 From: Emmanuel Durand Date: Tue, 11 Nov 2014 15:43:13 -0500 Subject: [PATCH] Fix: OpenNIGrabber::convertToXYZRGBPointCloud was using rgb camera parameters instead of the depth one to create the point cloud --- io/src/openni_grabber.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/io/src/openni_grabber.cpp b/io/src/openni_grabber.cpp index 727c9bcf03c..810dcc18329 100644 --- a/io/src/openni_grabber.cpp +++ b/io/src/openni_grabber.cpp @@ -637,22 +637,22 @@ pcl::OpenNIGrabber::convertToXYZRGBPointCloud (const boost::shared_ptrpoints.resize (cloud->height * cloud->width); //float constant = 1.0f / device_->getImageFocalLength (depth_width_); - register float constant_x = 1.0f / device_->getImageFocalLength (depth_width_); - register float constant_y = 1.0f / device_->getImageFocalLength (depth_width_); + register float constant_x = 1.0f / device_->getDepthFocalLength (depth_width_); + register float constant_y = 1.0f / device_->getDepthFocalLength (depth_width_); register float centerX = ((float)cloud->width - 1.f) / 2.f; register float centerY = ((float)cloud->height - 1.f) / 2.f; - if (pcl_isfinite (rgb_focal_length_x_)) - constant_x = 1.0f / static_cast (rgb_focal_length_x_); + if (pcl_isfinite (depth_focal_length_x_)) + constant_x = 1.0f / static_cast (depth_focal_length_x_); - if (pcl_isfinite (rgb_focal_length_y_)) - constant_y = 1.0f / static_cast (rgb_focal_length_y_); + if (pcl_isfinite (depth_focal_length_y_)) + constant_y = 1.0f / static_cast (depth_focal_length_y_); - if (pcl_isfinite (rgb_principal_point_x_)) - centerX = static_cast (rgb_principal_point_x_); + if (pcl_isfinite (depth_principal_point_x_)) + centerX = static_cast (depth_principal_point_x_); - if (pcl_isfinite (rgb_principal_point_y_)) - centerY = static_cast (rgb_principal_point_y_); + if (pcl_isfinite (depth_principal_point_y_)) + centerY = static_cast (depth_principal_point_y_); register const XnDepthPixel* depth_map = depth_image->getDepthMetaData ().Data (); if (depth_image->getWidth () != depth_width_ || depth_image->getHeight() != depth_height_)