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;