34 #ifndef TUW_GRID_MAP_H 35 #define TUW_GRID_MAP_H 65 template <
typename MapMetaData,
class ARRAY>
66 void init (
const MapMetaData &metadata, ARRAY *data )
72 template <
typename MapMetaData,
class ARRAY>
73 void init ( MapMetaData &metadata, ARRAY &data )
79 template <
typename MapMetaData>
80 void init (
const MapMetaData &metadata,
const T &data,
bool copy =
false)
85 std::copy(data.begin(), data.end(),
data_.begin());
101 void circle (
const Point2D &
p,
double radius, int8_t value,
int thickness=1,
int lineType = CV_AA ) {
102 cv::circle (
data_,
w2m ( p ).
cv(),
scale_w2m(radius), cv::Scalar(value), thickness, lineType );
106 cv::Mat element = cv::getStructuringElement( cv::MORPH_ELLIPSE,
107 cv::Size( 2*erosion_size + 1, 2*erosion_size+1 ),
108 cv::Point( erosion_size, erosion_size ) );
111 cv::dilate( I, I, element);
123 return data_ (
w2m ( _world_coordinates ).
cv() );
127 return data_ (
w2m ( _world_coordinates ).
cv() );
131 return data_ (
w2m ( _world_coordinates ).
cv() );
133 const T&
get (
const Point2D& _world_coordinates )
const 135 return data_ (
w2m ( _world_coordinates ).
cv() );
149 const cv::Mat_<T> &
mat()
const 185 return data_ ( row , col );
187 const T&
grid (
int row,
int col )
const 189 return data_ ( row , col );
199 #endif // TUW_GRID_MAP_H static const int8_t SPACE_FREE
bool isOccupyied(const Point2D &_world_coordinates) const
const T & getThresholdUnknown()
static const int8_t SPACE_NA
void setThresholdOccupied(const T &threshold)
void init(const MapMetaData &metadata, const T &data, bool copy=false)
const T & getThresholdFree()
void init()
initializes the transformation matrices
GridMap & operator=(const GridMap &)=default
Point2D w2m(const Point2D &src) const
double scale_w2m(double v) const
virtual ~GridMap()=default
bool isFree(const Point2D &_world_coordinates) const
const cv::Mat_< T > & mat() const
const T & grid(int row, int col) const
T & grid(int row, int col)
void erode(double distance, const GridMap &src=GridMap())
void init(const MapMetaData &metadata, ARRAY *data)
const T & getThresholdOccupied()
void setThresholdFree(const T &threshold)
static const int8_t SPACE_OCCUPIED
T & operator()(double x, double y)
void circle(const Point2D &p, double radius, int8_t value, int thickness=1, int lineType=CV_AA)
void setThresholdUnknown(const T &threshold)
void init(MapMetaData &metadata, ARRAY &data)
const cv::Point_< double > & cv() const