Apollo 10.0
自动驾驶开放平台
apollo::perception::lidar::Bitmap2D类 参考

#include <bitmap2d.h>

apollo::perception::lidar::Bitmap2D 的协作图:

Public 类型

enum class  DirectionMajor { XMAJOR = 0 , YMAJOR = 1 }
 
typedef Eigen::Matrix< size_t, 2, 1 > Vec2ui
 
typedef Eigen::Matrix< size_t, 3, 1 > Vec3ui
 

Public 成员函数

 Bitmap2D ()=default
 Construct a new Bitmap 2D object
 
virtual ~Bitmap2D ()=default
 Destroy the Bitmap 2D object
 
DirectionMajor OppositeDirection (const DirectionMajor dir_major)
 Opposite direction of direction_major
 
const Eigen::Vector2d & min_range () const
 Return the min_range_
 
const Eigen::Vector2d & max_range () const
 Return the max_range_
 
const Eigen::Vector2d & cell_size () const
 Return the cell_size_
 
const Vec2ui & map_size () const
 Return the map_size_
 
const Vec2ui & dims () const
 Retrun the dims_
 
const std::vector< uint64_t > & bitmap () const
 Return the bitmap_
 
int dir_major () const
 Return the dir_major_
 
int op_dir_major () const
 Return the op_dir_major
 
void Init (const Eigen::Vector2d &min_range, const Eigen::Vector2d &max_range, const Eigen::Vector2d &cell_size)
 Init of Bitmap 2D object
 
void SetUp (const DirectionMajor dir_major)
 Set the dir_major_ and op_dir_major_
 
bool Empty () const
 cehck the bitmap_ is emtpy
 
bool IsExists (const Eigen::Vector2d &p) const
 check the vector p is in bitmap_
 
bool Check (const Eigen::Vector2d &p) const
 Check the vector p
 
void Set (const Eigen::Vector2d &p)
 Set the vector p
 
void Reset (const Eigen::Vector2d &p)
 Reset the vector p
 
void Set (const double x, const double min_y, const double max_y)
 Set thr rangebits and headbits
 
void Reset (const double x, const double min_y, const double max_y)
 Reset the rangebits and headbits
 

友元

std::ostream & operator<< (std::ostream &out, const Bitmap2D &bitmap)
 print some meta data
 

详细描述

在文件 bitmap2d.h 第 29 行定义.

成员类型定义说明

◆ Vec2ui

typedef Eigen::Matrix<size_t, 2, 1> apollo::perception::lidar::Bitmap2D::Vec2ui

在文件 bitmap2d.h 第 32 行定义.

◆ Vec3ui

typedef Eigen::Matrix<size_t, 3, 1> apollo::perception::lidar::Bitmap2D::Vec3ui

在文件 bitmap2d.h 第 33 行定义.

成员枚举类型说明

◆ DirectionMajor

构造及析构函数说明

◆ Bitmap2D()

apollo::perception::lidar::Bitmap2D::Bitmap2D ( )
default

Construct a new Bitmap 2D object

◆ ~Bitmap2D()

virtual apollo::perception::lidar::Bitmap2D::~Bitmap2D ( )
virtualdefault

Destroy the Bitmap 2D object

成员函数说明

◆ bitmap()

const std::vector< uint64_t > & apollo::perception::lidar::Bitmap2D::bitmap ( ) const
inline

Return the bitmap_

返回
const std::vector<uint64_t>& bitmap_

在文件 bitmap2d.h 第 96 行定义.

96{ return bitmap_; }

◆ cell_size()

const Eigen::Vector2d & apollo::perception::lidar::Bitmap2D::cell_size ( ) const
inline

Return the cell_size_

返回
const Eigen::Vector2d& cell_size_

在文件 bitmap2d.h 第 75 行定义.

75{ return cell_size_; }

◆ Check()

bool apollo::perception::lidar::Bitmap2D::Check ( const Eigen::Vector2d &  p) const

Check the vector p

参数
p2d vector
返回
true
false

在文件 bitmap2d.cc 第 121 行定义.

121 {
122 const Vec3ui bit_p = RealToBitmap(p);
123 const int idx = Index(bit_p);
124 return CheckBit(bit_p.z(), bitmap_[idx]);
125}
Eigen::Matrix< size_t, 3, 1 > Vec3ui
Definition bitmap2d.h:33

◆ dims()

const Vec2ui & apollo::perception::lidar::Bitmap2D::dims ( ) const
inline

Retrun the dims_

返回
const Vec2ui& dims_

在文件 bitmap2d.h 第 89 行定义.

89{ return dims_; }

◆ dir_major()

int apollo::perception::lidar::Bitmap2D::dir_major ( ) const
inline

Return the dir_major_

返回
int dir_major_

在文件 bitmap2d.h 第 103 行定义.

103{ return static_cast<int>(dir_major_); }

◆ Empty()

bool apollo::perception::lidar::Bitmap2D::Empty ( ) const
inline

cehck the bitmap_ is emtpy

返回
true
false

在文件 bitmap2d.h 第 136 行定义.

136{ return bitmap_.empty(); }

◆ Init()

void apollo::perception::lidar::Bitmap2D::Init ( const Eigen::Vector2d &  min_range,
const Eigen::Vector2d &  max_range,
const Eigen::Vector2d &  cell_size 
)

Init of Bitmap 2D object

参数
min_rangemin range of the bitmap
max_rangemax range of the bitmap
cell_sizecell size of bitmap

在文件 bitmap2d.cc 第 72 行定义.

74 {
75 CHECK_GT(cell_size.x(), 0);
76 CHECK_GT(cell_size.y(), 0);
77 CHECK_GT(max_range.x(), min_range.x() + cell_size.x());
78 CHECK_GT(max_range.y(), min_range.y() + cell_size.y());
79
80 min_range_ = min_range;
81 max_range_ = max_range;
82 cell_size_ = cell_size;
83
84 dims_ =
85 ((max_range_ - min_range_).array() / cell_size_.array()).cast<size_t>();
86 dims_ += Vec2ui(1, 1);
87 map_size_[0] = dims_[0];
88 map_size_[1] = (dims_[1] >> 6) + 1;
89 bitmap_.resize(map_size_[0] * map_size_[1], 0);
90}
const Eigen::Vector2d & max_range() const
Return the max_range_
Definition bitmap2d.h:68
const Eigen::Vector2d & min_range() const
Return the min_range_
Definition bitmap2d.h:61
Eigen::Matrix< size_t, 2, 1 > Vec2ui
Definition bitmap2d.h:32
const Eigen::Vector2d & cell_size() const
Return the cell_size_
Definition bitmap2d.h:75

◆ IsExists()

bool apollo::perception::lidar::Bitmap2D::IsExists ( const Eigen::Vector2d &  p) const

check the vector p is in bitmap_

参数
p2d vector
返回
true
false

在文件 bitmap2d.cc 第 115 行定义.

115 {
116 return p.x() >= min_range_.x() && p.x() < max_range_.x() &&
117 p.y() >= min_range_.y() && p.y() < max_range_.y();
118}

◆ map_size()

const Vec2ui & apollo::perception::lidar::Bitmap2D::map_size ( ) const
inline

Return the map_size_

返回
const Vec2ui& map_size_

在文件 bitmap2d.h 第 82 行定义.

82{ return map_size_; }

◆ max_range()

const Eigen::Vector2d & apollo::perception::lidar::Bitmap2D::max_range ( ) const
inline

Return the max_range_

返回
const Eigen::Vector2d& max_range_

在文件 bitmap2d.h 第 68 行定义.

68{ return max_range_; }

◆ min_range()

const Eigen::Vector2d & apollo::perception::lidar::Bitmap2D::min_range ( ) const
inline

Return the min_range_

返回
const Eigen::Vector2d& min_range_

在文件 bitmap2d.h 第 61 行定义.

61{ return min_range_; }

◆ op_dir_major()

int apollo::perception::lidar::Bitmap2D::op_dir_major ( ) const
inline

Return the op_dir_major

返回
int op_dir_major

在文件 bitmap2d.h 第 110 行定义.

110{ return static_cast<int>(op_dir_major_); }

◆ OppositeDirection()

Bitmap2D::DirectionMajor apollo::perception::lidar::Bitmap2D::OppositeDirection ( const DirectionMajor  dir_major)
inline

Opposite direction of direction_major

参数
dir_majormajor direction
返回
DirectionMajor

在文件 bitmap2d.cc 第 28 行定义.

29 {
30 return static_cast<DirectionMajor>(static_cast<int>(dir_major) ^ 1);
31}
int dir_major() const
Return the dir_major_
Definition bitmap2d.h:103

◆ Reset() [1/2]

void apollo::perception::lidar::Bitmap2D::Reset ( const double  x,
const double  min_y,
const double  max_y 
)

Reset the rangebits and headbits

参数
xx position
min_ymin y of bitmap
max_ymax y of bitmap

在文件 bitmap2d.cc 第 161 行定义.

161 {
162 Eigen::Vector2d real_left, real_right;
163 real_left[op_dir_major()] = min_y;
164 real_right[op_dir_major()] = max_y;
165 real_left[dir_major()] = real_right[dir_major()] = x;
166 const Vec3ui left_bit_p = RealToBitmap(real_left);
167 const Vec3ui right_bit_p = RealToBitmap(real_right);
168 if (left_bit_p.y() == right_bit_p.y()) {
169 const int idx = Index(left_bit_p);
170 ResetRangeBits(right_bit_p.z() + 1, left_bit_p.z(), &bitmap_[idx]);
171 return;
172 }
173 // set first block and last block
174 const size_t left_idx = Index(left_bit_p);
175 const size_t right_idx = Index(right_bit_p);
176 ResetHeadBits(left_bit_p.z(), &bitmap_[left_idx]);
177 ResetTailBits(right_bit_p.z(), &bitmap_[right_idx]);
178 for (size_t i = left_idx + 1; i < right_idx; ++i) {
179 bitmap_[i] = static_cast<uint64_t>(0);
180 }
181}
int op_dir_major() const
Return the op_dir_major
Definition bitmap2d.h:110

◆ Reset() [2/2]

void apollo::perception::lidar::Bitmap2D::Reset ( const Eigen::Vector2d &  p)

Reset the vector p

参数
p2d vector

在文件 bitmap2d.cc 第 134 行定义.

134 {
135 const Vec3ui bit_p = RealToBitmap(p);
136 const int idx = Index(bit_p);
137 return ResetBit(bit_p.z(), &bitmap_[idx]);
138}

◆ Set() [1/2]

void apollo::perception::lidar::Bitmap2D::Set ( const double  x,
const double  min_y,
const double  max_y 
)

Set thr rangebits and headbits

参数
xx position
min_ymin y of bitmap
max_ymax y of bitmap

在文件 bitmap2d.cc 第 140 行定义.

140 {
141 Eigen::Vector2d real_left, real_right;
142 real_left[op_dir_major()] = min_y;
143 real_right[op_dir_major()] = max_y;
144 real_left[dir_major()] = real_right[dir_major()] = x;
145 const Vec3ui left_bit_p = RealToBitmap(real_left);
146 const Vec3ui right_bit_p = RealToBitmap(real_right);
147 if (left_bit_p.y() == right_bit_p.y()) {
148 const int idx = Index(left_bit_p);
149 SetRangeBits(right_bit_p.z(), left_bit_p.z(), &bitmap_[idx]);
150 return;
151 }
152 const size_t left_idx = Index(left_bit_p);
153 const size_t right_idx = Index(right_bit_p);
154 SetHeadBits(left_bit_p.z(), &bitmap_[left_idx]);
155 SetTailBits(right_bit_p.z(), &bitmap_[right_idx]);
156 for (size_t i = left_idx + 1; i < right_idx; ++i) {
157 bitmap_[i] = static_cast<uint64_t>(-1);
158 }
159}

◆ Set() [2/2]

void apollo::perception::lidar::Bitmap2D::Set ( const Eigen::Vector2d &  p)

Set the vector p

参数
p2d vector

在文件 bitmap2d.cc 第 128 行定义.

128 {
129 const Vec3ui bit_p = RealToBitmap(p);
130 const int idx = Index(bit_p);
131 return SetBit(bit_p.z(), &bitmap_[idx]);
132}

◆ SetUp()

void apollo::perception::lidar::Bitmap2D::SetUp ( const DirectionMajor  dir_major)

Set the dir_major_ and op_dir_major_

参数
dir_major

在文件 bitmap2d.cc 第 92 行定义.

92 {
93 dir_major_ = dir_major;
94 op_dir_major_ = OppositeDirection(dir_major);
95 memset(bitmap_.data(), 0, sizeof(bitmap_[0]) * bitmap_.size());
96}
DirectionMajor OppositeDirection(const DirectionMajor dir_major)
Opposite direction of direction_major
Definition bitmap2d.cc:28

友元及相关函数文档

◆ operator<<

std::ostream & operator<< ( std::ostream &  out,
const Bitmap2D &  bitmap 
)
friend

print some meta data

参数
out
bitmap
返回
std::ostream&

在文件 bitmap2d.h 第 196 行定义.

196 {
197 out << boost::format(
198 "min_range: %lf %lf; max_range: %lf %lf;"
199 "cell_size: %lf %lf; dims: %d %d; dir_major: %s") %
200 bitmap.min_range_.x() % bitmap.min_range_.y() %
201 bitmap.max_range_.x() % bitmap.max_range_.y() %
202 bitmap.cell_size_.x() % bitmap.cell_size_.y() %
203 bitmap.dims_.x() % bitmap.dims_.y() %
204 (bitmap.dir_major_ == DirectionMajor::XMAJOR ? "x" : "y");
205 return out;
206 }
const std::vector< uint64_t > & bitmap() const
Return the bitmap_
Definition bitmap2d.h:96

该类的文档由以下文件生成: