Skip to content

Commit a6a4236

Browse files
committed
Get the indices without the circular buffer offset
1 parent e3fad51 commit a6a4236

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

grid_map_cv/include/grid_map_cv/GridMapCvConverter.hpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,17 @@ class GridMapCvConverter
108108

109109
for (GridMapIterator iterator(gridMap); !iterator.isPastEnd(); ++iterator) {
110110
const Index index(*iterator);
111+
const Index imageIndex(iterator.getUnwrappedIndex());
111112

112113
// Check for alpha layer.
113114
if (hasAlpha) {
114115
const Type_ alpha =
115-
image.at<cv::Vec<Type_, NChannels_>>(index(0), index(1))[NChannels_ - 1];
116+
image.at<cv::Vec<Type_, NChannels_>>(imageIndex(0), imageIndex(1))[NChannels_ - 1];
116117
if (alpha < alphaTreshold) {continue;}
117118
}
118119

119120
// Compute value.
120-
const Type_ imageValue = imageMono.at<Type_>(index(0), index(1));
121+
const Type_ imageValue = imageMono.at<Type_>(imageIndex(0), imageIndex(1));
121122
const float mapValue = lowerValue + mapValueDifference *
122123
(static_cast<float>(imageValue) / maxImageValue);
123124
data(index(0), index(1)) = mapValue;

0 commit comments

Comments
 (0)