grid_map icon indicating copy to clipboard operation
grid_map copied to clipboard

Let toImage and addLayerFromImage propagate raw values

Open moritzkuhne opened this issue 3 years ago • 1 comments

For working with other 3rd party libraries, e.g. OpenCV, I would like to convert a layer of floating precision data type to a raw copy of the underlying data.

Like described here, if the data at a cell evaluates std::isfinite to false, its value in the conversion is zero. Furthermore, scaling takes place when converting to and from Mat.

Especially for floating type data, I would like to have the option to propagate numeric limits, like std::nanf and std::numeric_limits<float>::infinity

I looked at the code, and it seems to me that adding a function

template<int NChannels_>
static bool convertToMat(const grid_map::GridMap& gridMap, const std::string& layer,
                    const int encoding, cv::Mat& image)

is clearer, than adding more overloads to the function. Especially since without scaling many assumptions on images are not fulfilled. We write float values images, including non-finite values, to .pfm file. Its not the most widely used format, but I haven't seen something else for float images.

moritzkuhne avatar Sep 07 '22 14:09 moritzkuhne

Are there any news on this issue?

JoLichtenfeld avatar Jul 05 '23 16:07 JoLichtenfeld