template struct mrpt::maps::CLogOddsGridMapLUT
Overview
One static instance of this struct should exist in any class implementing CLogOddsGridMap2D to hold the Look-up-tables (LUTs) for log-odss Bayesian update.
Map cells must be type TCELL, which can be only:
int8_t or
int16_t
See also:
CLogOddsGridMap2D, see derived classes for usage examples.
#include <mrpt/maps/CLogOddsGridMapLUT.h> template <typename TCELL> struct CLogOddsGridMapLUT: public mrpt::maps::detail::logoddscell_traits { // typedefs typedef TCELL cell_t; typedef detail::logoddscell_traits<TCELL> traits_t; // fields std::vector<float> logoddsTable; std::vector<uint8_t> logoddsTable_255; std::vector<cell_t> p2lTable; // construction CLogOddsGridMapLUT(); // methods float l2p(const cell_t l); uint8_t l2p_255(const cell_t l); cell_t p2l(const float p); };
Typedefs
typedef TCELL cell_t
The type of.
Fields
std::vector<float> logoddsTable
A lookup table to compute occupancy probabilities in [0,1] from integer log-odds values in the cells, using \(p(m_{xy}) = \frac{1}{1+exp(-log_odd)}\).
std::vector<uint8_t> logoddsTable_255
A lookup table to compute occupancy probabilities in the range [0,255] from integer log-odds values in the cells, using \(p(m_{xy}) = \frac{1}{1+exp(-log_odd)}\).
This is used to speed-up conversions to grayscale images.
std::vector<cell_t> p2lTable
A lookup table for passing from float to log-odds as cell_t.
Construction
CLogOddsGridMapLUT()
Constructor: computes all the required stuff.
Methods
float l2p(const cell_t l)
Scales an integer representation of the log-odd into a real valued probability in [0,1], using p=exp(l)/(1+exp(l))
uint8_t l2p_255(const cell_t l)
Scales an integer representation of the log-odd into a linear scale [0,255], using p=exp(l)/(1+exp(l))
cell_t p2l(const float p)
Scales a real valued probability in [0,1] to an integer representation of: log(p)-log(1-p) in the valid range of cell_t.