#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) |
Conversions between grid maps and OpenCV images.
Definition at line 24 of file GridMapCvConverter.hpp.
static bool grid_map::GridMapCvConverter::addColorLayerFromImage | ( | const cv::Mat & | image, |
const std::string & | layer, | ||
grid_map::GridMap & | gridMap | ||
) | [inline, static] |
Adds a color layer with data from an image.
[in] | image | the image to be added (BGR format). |
[in] | layer | the layer that is filled with the image. |
[out] | gridMap | the grid map to be populated. |
Definition at line 128 of file GridMapCvConverter.hpp.
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 |
||
) | [inline, static] |
Adds a layer with data from image.
[in] | image | the image to be added. If it is a color image (bgr or bgra encoding), it will be transformed in a grayscale image. |
[in] | layer | the layer that is filled with the image data. |
[out] | gridMap | the grid map to be populated. |
[in] | optional) | lowerValue value of the layer corresponding to black image pixels. |
[in] | optional) | upperValue value of the layer corresponding to white image pixels. |
[in] | optional) | alphaThreshold the threshold ([0.0, 1.0]) for the alpha value at which cells in the grid map are marked as empty. |
Definition at line 59 of file GridMapCvConverter.hpp.
static bool grid_map::GridMapCvConverter::initializeFromImage | ( | const cv::Mat & | image, |
const double | resolution, | ||
grid_map::GridMap & | gridMap, | ||
const grid_map::Position & | position | ||
) | [inline, static] |
Initializes the geometry of a grid map from an image. This changes the geometry of the map and deletes all contents of the layers!
[in] | image | the image. |
[in] | resolution | the desired resolution of the grid map [m/cell]. |
[out] | gridMap | the grid map to be initialized. |
[in] | optional) | position the position of the grid map. |
Definition at line 36 of file GridMapCvConverter.hpp.
static bool grid_map::GridMapCvConverter::toImage | ( | const grid_map::GridMap & | gridMap, |
const std::string & | layer, | ||
const int | encoding, | ||
cv::Mat & | image | ||
) | [inline, static] |
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.
[in] | grid | map to be added. |
[in] | layer | the layer that is converted to the image. |
[in] | encoding | the desired encoding of the image. |
[in] | lowerValue | the value of the layer corresponding to black image pixels. |
[in] | upperValue | the value of the layer corresponding to white image pixels. |
[out] | image | the image to be populated. |
Definition at line 173 of file GridMapCvConverter.hpp.
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 | ||
) | [inline, static] |
Creates a cv mat from a grid map layer.
[in] | grid | map to be added. |
[in] | layer | the layer that is converted to the image. |
[in] | encoding | the desired encoding of the image. |
[in] | lowerValue | the value of the layer corresponding to black image pixels. |
[in] | upperValue | the value of the layer corresponding to white image pixels. |
[out] | image | the image to be populated. |
Definition at line 192 of file GridMapCvConverter.hpp.