1 #ifndef WORLD_SCOPED_MAPS_H
2 #define WORLD_SCOPED_MAPS_H
3 #include <opencv2/core/core.hpp>
4 #include <opencv2/core/core_c.h>
5 #include <opencv2/imgproc/imgproc.hpp>
47 void init (
int width_pixel,
int height_pixel,
double min_y,
double max_y,
double min_x,
double max_x,
double rotation = 0 );
53 template <
typename T>
void init(
const T &metadata){
55 dx_ = metadata.resolution * (double) metadata.width;
56 dy_ = metadata.resolution * (
double) metadata.height;
57 sx_ = 1.0/metadata.resolution;
58 sy_ = 1.0/metadata.resolution;
61 double roll = 0, pitch = 0, yaw = 0;
66 mx_ = metadata.origin.position.x;
67 my_ = metadata.origin.position.y;
68 cv::Matx<double, 3, 3 > Tw ( 1, 0, -
mx_, 0, 1, -
my_, 0, 0, 1 );
69 cv::Matx<double, 3, 3 > Sc (
sx_, 0, 0, 0,
sy_, 0, 0, 0, 1 );
70 cv::Matx<double, 3, 3 > R ( ca, -sa, 0, sa, ca, 0, 0, 0, 1 );
94 void line ( T &map,
const Point2D &p0,
const Point2D &p1,
const cv::Scalar &color,
int thickness=1,
int lineType = cv::LINE_AA )
const {
95 cv::line ( map,
w2m ( p0 ).
cv(),
w2m ( p1 ).
cv(), color, thickness, lineType );
106 template <
typename T>
107 void circle ( T &map,
const Point2D &
p,
int radius,
const cv::Scalar &color,
int thickness=1,
int lineType = cv::LINE_AA )
const{
108 cv::circle ( map,
w2m (
p ).
cv(), radius, color, thickness, lineType );
116 template <
typename T>
118 return map.at(
w2m (
p ).
cv() );
124 const cv::Matx33d &
Mw2m ()
const;
128 const cv::Matx33d &
Mm2w ()
const;
190 double min_x ()
const ;
194 double max_x ()
const ;
198 double min_y ()
const ;
202 double max_y ()
const ;
218 #endif // WORLD_SCOPED_MAPS_H