The data structure of ndt Map matrix.
更多...
#include <ndt_map_matrix.h>
|
| NdtMapMatrix () |
| The default constructor.
|
|
| ~NdtMapMatrix () |
| The default destructor.
|
|
| NdtMapMatrix (const NdtMapMatrix &cells) |
| The copy constructor.
|
|
virtual void | Init (const BaseMapConfig &config) |
| Initialize the matrix with the config.
|
|
virtual void | Reset () |
| Reset the matrix item to default value.
|
|
void | Init (unsigned int rows, unsigned int cols) |
| Initialize the matrix with the size of rows and columns.
|
|
void | Reset (unsigned int rows, unsigned int cols) |
| Reset the matrix item to default value.
|
|
virtual size_t | LoadBinary (const unsigned char *buf) |
| Load the map cell from a binary chunk.
|
|
virtual size_t | CreateBinary (unsigned char *buf, size_t buf_size) const |
| Create the binary.
|
|
virtual size_t | GetBinarySize () const |
| Get the binary size of the object.
|
|
virtual bool | GetIntensityImg (cv::Mat *intensity_img) const |
| get intensity image of node.
|
|
const NdtMapCells & | GetMapCell (unsigned int row, unsigned int col) const |
| Get a const map cell.
|
|
NdtMapCells & | GetMapCell (unsigned int row, unsigned int col) |
| Get a map cell.
|
|
unsigned int | GetRows () const |
| Get the size of row.
|
|
unsigned int | GetCols () const |
| Get the size of cols.
|
|
| BaseMapMatrix () |
| The default constructor.
|
|
virtual | ~BaseMapMatrix () |
| The deconstructor.
|
|
| BaseMapMatrix (const BaseMapMatrix &map_matrix) |
| The copy constructor.
|
|
virtual bool | GetAltitudeImg (cv::Mat *altitude_img) const |
| get altitude image of node.
|
|
The data structure of ndt Map matrix.
在文件 ndt_map_matrix.h 第 141 行定义.
◆ NdtMapMatrix() [1/2]
apollo::localization::msf::pyramid_map::NdtMapMatrix::NdtMapMatrix |
( |
| ) |
|
The default constructor.
在文件 ndt_map_matrix.cc 第 412 行定义.
412 {
413 rows_ = 0;
414 cols_ = 0;
415 map3d_cells_ = nullptr;
416}
◆ ~NdtMapMatrix()
apollo::localization::msf::pyramid_map::NdtMapMatrix::~NdtMapMatrix |
( |
| ) |
|
◆ NdtMapMatrix() [2/2]
apollo::localization::msf::pyramid_map::NdtMapMatrix::NdtMapMatrix |
( |
const NdtMapMatrix & |
cells | ) |
|
The copy constructor.
在文件 ndt_map_matrix.cc 第 420 行定义.
420 {
421 Init(cells.rows_, cells.cols_);
422 for (unsigned int y = 0; y < rows_; ++y) {
423 for (unsigned int x = 0; x < cols_; ++x) {
425 const NdtMapCells& src_cell = cells.GetMapCell(y, x);
427 }
428 }
429}
virtual void Init(const BaseMapConfig &config)
Initialize the matrix with the config.
const NdtMapCells & GetMapCell(unsigned int row, unsigned int col) const
Get a const map cell.
apollo::localization::msf::pyramid_map::NdtMapCells NdtMapCells
◆ CreateBinary()
size_t apollo::localization::msf::pyramid_map::NdtMapMatrix::CreateBinary |
( |
unsigned char * |
buf, |
|
|
size_t |
buf_size |
|
) |
| const |
|
virtual |
Create the binary.
Serialization of the object.
- 参数
-
<buf,buf_size> | The buffer and its size. |
<return> | The required or the used size of is returned. |
在文件 ndt_map_matrix.cc 第 468 行定义.
468 {
470 if (buf_size >= target_size) {
471 unsigned int* p = reinterpret_cast<unsigned int*>(buf);
472 *p = rows_;
473 ++p;
474 *p = cols_;
475 ++p;
476 buf_size -= static_cast<unsigned int>(sizeof(unsigned int) * 2);
477 unsigned char* pp = reinterpret_cast<unsigned char*>(p);
478 for (unsigned int y = 0; y < rows_; ++y) {
479 for (unsigned int x = 0; x < cols_; ++x) {
481 size_t processed_size = cell.CreateBinary(pp, buf_size);
482 assert(buf_size >= processed_size);
483 buf_size -= processed_size;
484 pp += processed_size;
485 }
486 }
487 }
488 return target_size;
489}
virtual size_t GetBinarySize() const
Get the binary size of the object.
◆ GetBinarySize()
size_t apollo::localization::msf::pyramid_map::NdtMapMatrix::GetBinarySize |
( |
| ) |
const |
|
virtual |
Get the binary size of the object.
在文件 ndt_map_matrix.cc 第 491 行定义.
491 {
492 size_t target_size = sizeof(unsigned int) * 2;
493 for (unsigned int y = 0; y < rows_; ++y) {
494 for (unsigned int x = 0; x < cols_; ++x) {
496 target_size += cell.GetBinarySize();
497 }
498 }
499 return target_size;
500}
◆ GetCols()
unsigned int apollo::localization::msf::pyramid_map::NdtMapMatrix::GetCols |
( |
| ) |
const |
|
inline |
◆ GetIntensityImg()
bool apollo::localization::msf::pyramid_map::NdtMapMatrix::GetIntensityImg |
( |
cv::Mat * |
intensity_img | ) |
const |
|
virtual |
get intensity image of node.
重载 apollo::localization::msf::pyramid_map::BaseMapMatrix .
在文件 ndt_map_matrix.cc 第 512 行定义.
512 {
513 *intensity_img = cv::Mat(cv::Size(cols_, rows_), CV_8UC1);
514 for (unsigned int y = 0; y < rows_; ++y) {
515 for (unsigned int x = 0; x < cols_; ++x) {
516 unsigned int id = y * cols_ + x;
517 int min_altitude_index = map3d_cells_[id].min_altitude_index_;
518 intensity_img->at<unsigned char>(y, x) =
519 (unsigned char)(map3d_cells_[id]
520 .cells_[min_altitude_index]
521 .intensity_);
522 }
523 }
524 return true;
525}
◆ GetMapCell() [1/2]
NdtMapCells & apollo::localization::msf::pyramid_map::NdtMapMatrix::GetMapCell |
( |
unsigned int |
row, |
|
|
unsigned int |
col |
|
) |
| |
|
inline |
Get a map cell.
在文件 ndt_map_matrix.h 第 181 行定义.
181 {
182 assert(row < rows_);
183 assert(col < cols_);
184 return map3d_cells_[row * cols_ + col];
185 }
◆ GetMapCell() [2/2]
const NdtMapCells & apollo::localization::msf::pyramid_map::NdtMapMatrix::GetMapCell |
( |
unsigned int |
row, |
|
|
unsigned int |
col |
|
) |
| const |
|
inline |
Get a const map cell.
在文件 ndt_map_matrix.h 第 174 行定义.
175 {
176 assert(row < rows_);
177 assert(col < cols_);
178 return map3d_cells_[row * cols_ + col];
179 }
◆ GetRows()
unsigned int apollo::localization::msf::pyramid_map::NdtMapMatrix::GetRows |
( |
| ) |
const |
|
inline |
◆ Init() [1/2]
void apollo::localization::msf::pyramid_map::NdtMapMatrix::Init |
( |
const BaseMapConfig & |
config | ) |
|
|
virtual |
◆ Init() [2/2]
void apollo::localization::msf::pyramid_map::NdtMapMatrix::Init |
( |
unsigned int |
rows, |
|
|
unsigned int |
cols |
|
) |
| |
Initialize the matrix with the size of rows and columns.
在文件 ndt_map_matrix.cc 第 437 行定义.
437 {
438 map3d_cells_.reset(new NdtMapCells[rows * cols]);
439 rows_ = rows;
440 cols_ = cols;
441}
◆ LoadBinary()
size_t apollo::localization::msf::pyramid_map::NdtMapMatrix::LoadBinary |
( |
const unsigned char * |
buf | ) |
|
|
virtual |
Load the map cell from a binary chunk.
- 参数
-
<return> | The size read (the real size of object). |
在文件 ndt_map_matrix.cc 第 450 行定义.
450 {
451 const unsigned int* p = reinterpret_cast<const unsigned int*>(buf);
452 rows_ = *p;
453 ++p;
454 cols_ = *p;
455 ++p;
457 const unsigned char* pp = reinterpret_cast<const unsigned char*>(p);
458 for (unsigned int y = 0; y < rows_; ++y) {
459 for (unsigned int x = 0; x < cols_; ++x) {
461 size_t processed_size = cell.LoadBinary(pp);
462 pp += processed_size;
463 }
464 }
466}
◆ Reduce()
void apollo::localization::msf::pyramid_map::NdtMapMatrix::Reduce |
( |
NdtMapMatrix * |
cells, |
|
|
const NdtMapMatrix & |
cells_new |
|
) |
| |
|
static |
Combine two NdtMapMatrix instances (Reduce).
在文件 ndt_map_matrix.cc 第 502 行定义.
502 {
503 for (unsigned int y = 0; y < cells->GetRows(); ++y) {
504 for (unsigned int x = 0; x < cells->GetCols(); ++x) {
506 const NdtMapCells& cell_new = cells_new.GetMapCell(y, x);
508 }
509 }
510}
static void Reduce(NdtMapCells *cell, const NdtMapCells &cell_new)
Combine two MapCell instances (Reduce).
◆ Reset() [1/2]
void apollo::localization::msf::pyramid_map::NdtMapMatrix::Reset |
( |
| ) |
|
|
virtual |
◆ Reset() [2/2]
void apollo::localization::msf::pyramid_map::NdtMapMatrix::Reset |
( |
unsigned int |
rows, |
|
|
unsigned int |
cols |
|
) |
| |
Reset the matrix item to default value.
在文件 ndt_map_matrix.cc 第 443 行定义.
443 {
444 unsigned int length = rows * cols;
445 for (unsigned int i = 0; i < length; ++i) {
446 map3d_cells_[i].Reset();
447 }
448}
该类的文档由以下文件生成: