@@ -692,6 +692,11 @@ k4a_result_t K4AROSDevice::fillColorPointCloud(const k4a::image& pointcloud_imag
692
692
693
693
pcd_modifier.resize (point_count);
694
694
695
+ // Restore actual dimensions as pcd_modifier.resize(n) sets the cloud size to n x 1
696
+ point_cloud->height = pointcloud_image.get_height_pixels ();
697
+ point_cloud->width = pointcloud_image.get_width_pixels ();
698
+ point_cloud->row_step = pointcloud_image.get_width_pixels () * point_cloud->point_step ;
699
+
695
700
const int16_t * point_cloud_buffer = reinterpret_cast <const int16_t *>(pointcloud_image.get_buffer ());
696
701
const uint8_t * color_buffer = color_image.get_buffer ();
697
702
@@ -724,8 +729,6 @@ k4a_result_t K4AROSDevice::fillColorPointCloud(const k4a::image& pointcloud_imag
724
729
725
730
k4a_result_t K4AROSDevice::fillPointCloud (const k4a::image& pointcloud_image, sensor_msgs::PointCloud2Ptr& point_cloud)
726
731
{
727
- point_cloud->height = pointcloud_image.get_height_pixels ();
728
- point_cloud->width = pointcloud_image.get_width_pixels ();
729
732
point_cloud->is_dense = false ;
730
733
point_cloud->is_bigendian = false ;
731
734
@@ -740,6 +743,11 @@ k4a_result_t K4AROSDevice::fillPointCloud(const k4a::image& pointcloud_image, se
740
743
741
744
pcd_modifier.resize (point_count);
742
745
746
+ // Set actual dimensions as pcd_modifier.resize(n) sets the cloud size to n x 1
747
+ point_cloud->height = pointcloud_image.get_height_pixels ();
748
+ point_cloud->width = pointcloud_image.get_width_pixels ();
749
+ point_cloud->row_step = pointcloud_image.get_width_pixels () * point_cloud->point_step ;
750
+
743
751
const int16_t * point_cloud_buffer = reinterpret_cast <const int16_t *>(pointcloud_image.get_buffer ());
744
752
745
753
for (size_t i = 0 ; i < point_count; i++, ++iter_x, ++iter_y, ++iter_z)
0 commit comments