Static Public Member Functions | List of all members
grid_map::GridMapCvConverter Class Reference

#include <GridMapCvConverter.hpp>

Static Public Member Functions

template<typename Type_ , int NChannels_>
static bool addColorLayerFromImage (const cv::Mat &image, const std::string &layer, grid_map::GridMap &gridMap)
 
template<typename Type_ , int NChannels_>
static bool addLayerFromImage (const cv::Mat &image, const std::string &layer, grid_map::GridMap &gridMap, const float lowerValue=0.0, const float upperValue=1.0, const double alphaThreshold=0.5)
 
static bool initializeFromImage (const cv::Mat &image, const double resolution, grid_map::GridMap &gridMap, const grid_map::Position &position)
 
template<typename Type_ , int NChannels_>
static bool toImage (const grid_map::GridMap &gridMap, const std::string &layer, const int encoding, cv::Mat &image)
 
template<typename Type_ , int NChannels_>
static bool toImage (const grid_map::GridMap &gridMap, const std::string &layer, const int encoding, const float lowerValue, const float upperValue, cv::Mat &image)
 

Detailed Description

Conversions between grid maps and OpenCV images.

Definition at line 24 of file GridMapCvConverter.hpp.

Member Function Documentation

◆ addColorLayerFromImage()

template<typename Type_ , int NChannels_>
static bool grid_map::GridMapCvConverter::addColorLayerFromImage ( const cv::Mat &  image,
const std::string &  layer,
grid_map::GridMap gridMap 
)
inlinestatic

Adds a color layer with data from an image.

Parameters
[in]imagethe image to be added (BGR format).
[in]layerthe layer that is filled with the image.
[out]gridMapthe grid map to be populated.
Returns
true if successful, false otherwise.

Definition at line 129 of file GridMapCvConverter.hpp.

◆ addLayerFromImage()

template<typename Type_ , int NChannels_>
static bool grid_map::GridMapCvConverter::addLayerFromImage ( const cv::Mat &  image,
const std::string &  layer,
grid_map::GridMap gridMap,
const float  lowerValue = 0.0,
const float  upperValue = 1.0,
const double  alphaThreshold = 0.5 
)
inlinestatic

Adds a layer with data from image.

Parameters
[in]imagethe image to be added. If it is a color image (bgr or bgra encoding), it will be transformed in a grayscale image.
[in]layerthe layer that is filled with the image data.
[out]gridMapthe grid map to be populated.
[in]

Definition at line 59 of file GridMapCvConverter.hpp.

◆ initializeFromImage()

static bool grid_map::GridMapCvConverter::initializeFromImage ( const cv::Mat &  image,
const double  resolution,
grid_map::GridMap gridMap,
const grid_map::Position position 
)
inlinestatic

Initializes the geometry of a grid map from an image. This changes the geometry of the map and deletes all contents of the layers!

Parameters
[in]imagethe image.
[in]resolutionthe desired resolution of the grid map [m/cell].
[out]gridMapthe grid map to be initialized.
[in]

Definition at line 36 of file GridMapCvConverter.hpp.

◆ toImage() [1/2]

template<typename Type_ , int NChannels_>
static bool grid_map::GridMapCvConverter::toImage ( const grid_map::GridMap gridMap,
const std::string &  layer,
const int  encoding,
cv::Mat &  image 
)
inlinestatic

Creates a cv mat from a grid map layer. This conversion sets the corresponding black and white pixel value to the min. and max. data of the layer data.

Parameters
[in]gridmap to be added.
[in]layerthe layer that is converted to the image.
[in]encodingthe desired encoding of the image.
[in]lowerValuethe value of the layer corresponding to black image pixels.
[in]upperValuethe value of the layer corresponding to white image pixels.
[out]imagethe image to be populated.
Returns
true if successful, false otherwise.

Definition at line 174 of file GridMapCvConverter.hpp.

◆ toImage() [2/2]

template<typename Type_ , int NChannels_>
static bool grid_map::GridMapCvConverter::toImage ( const grid_map::GridMap gridMap,
const std::string &  layer,
const int  encoding,
const float  lowerValue,
const float  upperValue,
cv::Mat &  image 
)
inlinestatic

Creates a cv mat from a grid map layer.

Parameters
[in]gridmap to be added.
[in]layerthe layer that is converted to the image.
[in]encodingthe desired encoding of the image.
[in]lowerValuethe value of the layer corresponding to black image pixels.
[in]upperValuethe value of the layer corresponding to white image pixels.
[out]imagethe image to be populated.
Returns
true if successful, false otherwise.

Definition at line 193 of file GridMapCvConverter.hpp.


The documentation for this class was generated from the following file:


grid_map_cv
Author(s): Péter Fankhauser , Magnus Gärtner
autogenerated on Wed Jul 5 2023 02:23:39