From 614e19d96bd8415dbfb52d86df0f3774a9f462fe Mon Sep 17 00:00:00 2001 From: Markus Vieth Date: Mon, 10 Jan 2022 14:49:21 +0100 Subject: [PATCH] Fix row initialization in integral image Problem introduced in commit https://github.com/PointCloudLibrary/pcl/commit/78dc48d6a4836d1ecee9dd1ceedefe8a3b6877be The function Eigen::Matrix::Zero(Index size) is intended only for dynamic-size vectors. If used for fixed-size vectors, size must be the vector length, else an assert in Eigen aborts the program. The row is correctly initialized by calling setZero() on every element. --- features/include/pcl/features/impl/integral_image2D.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/features/include/pcl/features/impl/integral_image2D.hpp b/features/include/pcl/features/impl/integral_image2D.hpp index a0f424807f4..9e6e3be4c0c 100644 --- a/features/include/pcl/features/impl/integral_image2D.hpp +++ b/features/include/pcl/features/impl/integral_image2D.hpp @@ -158,7 +158,8 @@ IntegralImage2D::computeIntegralImages ( { ElementType* previous_row = &first_order_integral_image_[0]; ElementType* current_row = previous_row + (width_ + 1); - *previous_row = ElementType::Zero(width_ + 1); + for (unsigned int i = 0; i < (width_ + 1); ++i) + previous_row[i].setZero(); unsigned* count_previous_row = &finite_values_integral_image_[0]; unsigned* count_current_row = count_previous_row + (width_ + 1); @@ -189,7 +190,8 @@ IntegralImage2D::computeIntegralImages ( { SecondOrderType* so_previous_row = &second_order_integral_image_[0]; SecondOrderType* so_current_row = so_previous_row + (width_ + 1); - *so_previous_row = SecondOrderType::Zero(width_ + 1); + for (unsigned int i = 0; i < (width_ + 1); ++i) + so_previous_row[i].setZero(); SecondOrderType so_element; for (unsigned rowIdx = 0; rowIdx < height_; ++rowIdx, data += row_stride,