Skip to content

Commit

Permalink
Get the indices without the circular buffer offset
Browse files Browse the repository at this point in the history
  • Loading branch information
ipa-dmo committed Jun 11, 2024
1 parent e3fad51 commit a6a4236
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions grid_map_cv/include/grid_map_cv/GridMapCvConverter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,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<cv::Vec<Type_, NChannels_>>(index(0), index(1))[NChannels_ - 1];
image.at<cv::Vec<Type_, NChannels_>>(imageIndex(0), imageIndex(1))[NChannels_ - 1];
if (alpha < alphaTreshold) {continue;}
}

// Compute value.
const Type_ imageValue = imageMono.at<Type_>(index(0), index(1));
const Type_ imageValue = imageMono.at<Type_>(imageIndex(0), imageIndex(1));
const float mapValue = lowerValue + mapValueDifference *
(static_cast<float>(imageValue) / maxImageValue);
data(index(0), index(1)) = mapValue;
Expand Down

0 comments on commit a6a4236

Please sign in to comment.