From a63203ffe83d81b07e7f1c1e449f4b98c0708fc9 Mon Sep 17 00:00:00 2001 From: Dominik Moss Date: Tue, 11 Jun 2024 09:42:36 +0200 Subject: [PATCH] Get the indices without the circular buffer offset --- grid_map_cv/include/grid_map_cv/GridMapCvConverter.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/grid_map_cv/include/grid_map_cv/GridMapCvConverter.hpp b/grid_map_cv/include/grid_map_cv/GridMapCvConverter.hpp index 233c28a0..a8c82a3a 100644 --- a/grid_map_cv/include/grid_map_cv/GridMapCvConverter.hpp +++ b/grid_map_cv/include/grid_map_cv/GridMapCvConverter.hpp @@ -116,16 +116,17 @@ class GridMapCvConverter for (GridMapIterator iterator(gridMap); !iterator.isPastEnd(); ++iterator) { const Index index(*iterator); + const Index imageIndex(iterator.getUnwrappedIndex()); // Check for alpha layer. if (hasAlpha) { const Type_ alpha = - image.at>(index(0), index(1))[NChannels_ - 1]; + image.at>(imageIndex(0), imageIndex(1))[NChannels_ - 1]; if (alpha < alphaTreshold) {continue;} } // Compute value. - const Type_ imageValue = imageMono.at(index(0), index(1)); + const Type_ imageValue = imageMono.at(imageIndex(0), imageIndex(1)); const float mapValue = lowerValue + mapValueDifference * (static_cast(imageValue) / maxImageValue); data(index(0), index(1)) = mapValue;