Apollo 10.0
自动驾驶开放平台
apollo::localization::msf::pyramid_map::PyramidMapMatrix类 参考

#include <pyramid_map_matrix.h>

类 apollo::localization::msf::pyramid_map::PyramidMapMatrix 继承关系图:
apollo::localization::msf::pyramid_map::PyramidMapMatrix 的协作图:

Public 成员函数

 PyramidMapMatrix ()
 
 ~PyramidMapMatrix ()
 
 PyramidMapMatrix (const PyramidMapMatrix &map_matrix)
 
virtual void Init (const BaseMapConfig &config)
 Initialize the map matrix.
 
virtual void Reset ()
 Reset map cells data.
 
void Init (unsigned int rows, unsigned int cols, bool has_intensity=true, bool has_intensity_var=true, bool has_altitude=true, bool has_altitude_var=true, bool has_ground_altitude=true, bool has_count=true, bool has_ground_count=true, unsigned int resolution_num=1, unsigned int ratio=2)
 
void Reset (unsigned int level)
 Reset all of map cells data in a specific resolution level.
 
void ResetCells (unsigned int start_id, unsigned int end_id, unsigned int level=0)
 Reset map cells data from start_id to end_id in a specific resolution level
 
void ResetCell (unsigned int id, unsigned int level=0)
 Reset a map cell in a specific resolution level.
 
void Clear ()
 Release all memory in PyramidMapMatrix.
 
virtual bool GetIntensityImg (cv::Mat *intensity_img) const
 get intensity image of node.
 
bool GetIntensityImg (unsigned int level, cv::Mat *intensity_img) const
 
virtual bool GetAltitudeImg (cv::Mat *altitude_img) const
 get altitude image of node.
 
bool GetAltitudeImg (unsigned int level, cv::Mat *altitude_img) const
 
void BottomUpSafe ()
 Propagate the data from fine level to the coarse resolution by check.
 
void BottomUpBase ()
 Propagate the data from fine level to the coarse resolution by check.
 
PyramidMapMatrixoperator= (const PyramidMapMatrix &map_matrix)
 
const float * GetIntensitySafe (unsigned int row, unsigned int col, unsigned int level=0) const
 Get an intensity value by check.
 
const float * GetIntensityVarSafe (unsigned int row, unsigned int col, unsigned int level=0) const
 Get an intensity variance value by check.
 
const float * GetAltitudeSafe (unsigned int row, unsigned int col, unsigned int level=0) const
 Get an altitude value by check.
 
const float * GetAltitudeVarSafe (unsigned int row, unsigned int col, unsigned int level=0) const
 Get an altitude variance value by check.
 
const float * GetGroundAltitudeSafe (unsigned int row, unsigned int col, unsigned int level=0) const
 Get an altitude ground value by check.
 
const unsigned int * GetCountSafe (unsigned int row, unsigned int col, unsigned int level=0) const
 Get a count value by check.
 
const unsigned int * GetGroundCountSafe (unsigned int row, unsigned int col, unsigned int level=0) const
 Get a ground count value by check.
 
void GetMapCellSafe (float **intensity, float **intensity_var, float **altitude, float **altitude_var, float **ground_altitude, unsigned int **count, unsigned int **ground_count, unsigned int row, unsigned int col, unsigned int level=0)
 Get cell values by check.
 
FloatMatrixGetIntensityMatrixSafe (unsigned int level=0)
 
FloatMatrixGetIntensityVarMatrixSafe (unsigned int level=0)
 
FloatMatrixGetAltitudeMatrixSafe (unsigned int level=0)
 
FloatMatrixGetAltitudeVarMatrixSafe (unsigned int level=0)
 
FloatMatrixGetGroundAltitudeMatrixSafe (unsigned int level=0)
 
UIntMatrixGetCountMatrixSafe (unsigned int level=0)
 
UIntMatrixGetGroundCountMatrixSafe (unsigned int level=0)
 
const FloatMatrixGetIntensityMatrixSafe (unsigned int level=0) const
 
const FloatMatrixGetIntensityVarMatrixSafe (unsigned int level=0) const
 
const FloatMatrixGetAltitudeMatrixSafe (unsigned int level=0) const
 
const FloatMatrixGetAltitudeVarMatrixSafe (unsigned int level=0) const
 
const FloatMatrixGetGroundAltitudeMatrixSafe (unsigned int level=0) const
 
const UIntMatrixGetCountMatrixSafe (unsigned int level=0) const
 
const UIntMatrixGetGroundCountMatrixSafe (unsigned int level=0) const
 
void SetIntensityMatrix (const float *input, unsigned int size, unsigned int start_index, unsigned int level=0)
 
void SetIntensityVarMatrix (const float *input, unsigned int size, unsigned int start_index, unsigned int level=0)
 
void SetAltitudeMatrix (const float *input, unsigned int size, unsigned int start_index, unsigned int level=0)
 
void SetAltitudeVarMatrix (const float *input, unsigned int size, unsigned int start_index, unsigned int level=0)
 
void SetGroundAltitudeMatrix (const float *input, unsigned int size, unsigned int start_index, unsigned int level=0)
 
void SetCountMatrix (const unsigned int *input, unsigned int size, unsigned int start_index, unsigned int level=0)
 
void SetGroundCountMatrix (const unsigned int *input, unsigned int size, unsigned int start_index, unsigned int level=0)
 
void SetFloatMatrixRoi (const FloatMatrix *source_matrix, const Rect2D< unsigned int > &source_roi, const Rect2D< unsigned int > &target_roi, unsigned int type, unsigned int level=0)
 set float matrix with a ROI.
 
void SetUintMatrixRoi (const UIntMatrix *source_matrix, const Rect2D< unsigned int > &source_roi, const Rect2D< unsigned int > &target_roi, unsigned int type, unsigned int level=0)
 set unsigned int matrix with a ROI.
 
void SetIntensitySafe (float intensity, unsigned int row, unsigned int col, unsigned int level=0)
 Set an intensity value by check.
 
void SetIntensityVarSafe (float intensity_var, unsigned int row, unsigned int col, unsigned int level=0)
 Set an intensity variance value by check.
 
void SetAltitudeSafe (float altitude, unsigned int row, unsigned int col, unsigned int level=0)
 Set an altitude value by check.
 
void SetAltitudeVarSafe (float altitude_var, unsigned int row, unsigned int col, unsigned int level=0)
 Set an altitude variance value by check.
 
void SetGroundAltitudeSafe (float ground_altitude, unsigned int row, unsigned int col, unsigned int level=0)
 Set an altitude ground value by check.
 
void SetCountSafe (unsigned int count, unsigned int row, unsigned int col, unsigned int level=0)
 Set a count value by check.
 
void SetGroundCountSafe (unsigned int ground_count, unsigned int row, unsigned int col, unsigned int level=0)
 Set a ground count value by check.
 
void SetValueSafe (unsigned char intensity, float altitude, unsigned int row, unsigned int col, unsigned int level=0)
 Set the several values by check.
 
void MergeCellSafe (const float *intensity, const float *intensity_var, const float *altitude, const float *altitude_var, const float *ground_altitude, const unsigned int *count, const unsigned int *ground_count, unsigned int row, unsigned int col, unsigned int level)
 Merge the data from another map cell by check.
 
void AddSampleSafe (float intensity, float altitude, unsigned int row, unsigned int col, unsigned int level)
 Add sample to the map cell with check.
 
void AddGroundSample (float ground_altitude, unsigned int row, unsigned int col, unsigned int level=0)
 Add ground sample to the map cell.
 
double ComputeMeanIntensity (unsigned int level=0)
 Compute mean intensity.
 
bool HasIntensity () const
 
bool HasIntensityVar () const
 
bool HasAltitude () const
 
bool HasAltitudeVar () const
 
bool HasGroundAltitude () const
 
bool HasCount () const
 
bool HasGroundCount () const
 
unsigned int GetRowsSafe (unsigned int level=0) const
 Get row number given the resolution by check.
 
unsigned int GetColsSafe (unsigned int level=0) const
 Get column number given the resolution by check.
 
unsigned int GetRows (unsigned int level=0) const
 Get row number given the resolution.
 
unsigned int GetCols (unsigned int level=0) const
 Get column number given the resolution.
 
unsigned int GetResolutionNum () const
 Get number of resolution.
 
unsigned int GetResolutionRatio () const
 Get the resolution ratio.
 
void AddSampleBase (float intensity, float altitude, unsigned int row, unsigned int col, unsigned int level)
 Add sample to the map cell.
 
void MergeCellBase (const float *intensity, const float *intensity_var, const float *altitude, const unsigned int *count, unsigned int row, unsigned int col, unsigned int level)
 Merge the data from another map cell.
 
void GetMapCellBase (float **intensity, float **intensity_var, float **altitude, unsigned int **count, unsigned int row, unsigned int col, unsigned int level=0)
 Get cell values.
 
const float * GetIntensity (unsigned int row, unsigned int col, unsigned int level=0) const
 Get an intensity value without check.
 
const float * GetIntensityVar (unsigned int row, unsigned int col, unsigned int level=0) const
 Get an intensity variance value by check.
 
const float * GetAltitude (unsigned int row, unsigned int col, unsigned int level=0) const
 Get an altitude value without check.
 
const float * GetAltitudeVar (unsigned int row, unsigned int col, unsigned int level=0) const
 Get an altitude variance value without check.
 
const float * GetGroundAltitude (unsigned int row, unsigned int col, unsigned int level=0) const
 Get an altitude ground value without check.
 
const unsigned int * GetCount (unsigned int row, unsigned int col, unsigned int level=0) const
 Get a count value without check.
 
const unsigned int * GetGroundCount (unsigned int row, unsigned int col, unsigned int level=0) const
 Get a ground count value without check.
 
FloatMatrixGetIntensityMatrix (unsigned int level=0)
 
FloatMatrixGetIntensityVarMatrix (unsigned int level=0)
 
FloatMatrixGetAltitudeMatrix (unsigned int level=0)
 
FloatMatrixGetAltitudeVarMatrix (unsigned int level=0)
 
FloatMatrixGetGroundAltitudeMatrix (unsigned int level=0)
 
UIntMatrixGetCountMatrix (unsigned int level=0)
 
UIntMatrixGetGroundCountMatrix (unsigned int level=0)
 
const FloatMatrixGetIntensityMatrix (unsigned int level=0) const
 
const FloatMatrixGetIntensityVarMatrix (unsigned int level=0) const
 
const FloatMatrixGetAltitudeMatrix (unsigned int level=0) const
 
const FloatMatrixGetAltitudeVarMatrix (unsigned int level=0) const
 
const FloatMatrixGetGroundAltitudeMatrix (unsigned int level=0) const
 
const UIntMatrixGetCountMatrix (unsigned int level=0) const
 
const UIntMatrixGetGroundCountMatrix (unsigned int level=0) const
 
- Public 成员函数 继承自 apollo::localization::msf::pyramid_map::BaseMapMatrix
 BaseMapMatrix ()
 The default constructor.
 
virtual ~BaseMapMatrix ()
 The deconstructor.
 
 BaseMapMatrix (const BaseMapMatrix &map_matrix)
 The copy constructor.
 

静态 Public 成员函数

static void Reduce (std::shared_ptr< PyramidMapMatrix > cells, const PyramidMapMatrix &new_cells, unsigned int level=0, unsigned int new_level=0)
 Combine two PyramidMapMatrix instances (Reduce).
 

详细描述

在文件 pyramid_map_matrix.h33 行定义.

构造及析构函数说明

◆ PyramidMapMatrix() [1/2]

apollo::localization::msf::pyramid_map::PyramidMapMatrix::PyramidMapMatrix ( )

在文件 pyramid_map_matrix.cc27 行定义.

27{ Clear(); }
void Clear()
Release all memory in PyramidMapMatrix.

◆ ~PyramidMapMatrix()

apollo::localization::msf::pyramid_map::PyramidMapMatrix::~PyramidMapMatrix ( )

在文件 pyramid_map_matrix.cc29 行定义.

29{ Clear(); }

◆ PyramidMapMatrix() [2/2]

apollo::localization::msf::pyramid_map::PyramidMapMatrix::PyramidMapMatrix ( const PyramidMapMatrix map_matrix)
explicit

在文件 pyramid_map_matrix.cc31 行定义.

31 {
32 Clear();
33 resolution_num_ = map_matrix.resolution_num_;
34 ratio_ = map_matrix.ratio_;
35 rows_mr_ = map_matrix.rows_mr_;
36 cols_mr_ = map_matrix.cols_mr_;
37 ratio_multiplier_ = map_matrix.ratio_multiplier_;
38
39 intensity_matrixes_ = map_matrix.intensity_matrixes_;
40 intensity_var_matrixes_ = map_matrix.intensity_var_matrixes_;
41 altitude_matrixes_ = map_matrix.altitude_matrixes_;
42 altitude_var_matrixes_ = map_matrix.altitude_var_matrixes_;
43 ground_altitude_matrixes_ = map_matrix.ground_altitude_matrixes_;
44 count_matrixes_ = map_matrix.count_matrixes_;
45 ground_count_matrixes_ = map_matrix.ground_count_matrixes_;
46
47 has_intensity_ = map_matrix.has_intensity_;
48 has_intensity_var_ = map_matrix.has_intensity_var_;
49 has_altitude_ = map_matrix.has_altitude_;
50 has_altitude_var_ = map_matrix.has_altitude_var_;
51 has_ground_altitude_ = map_matrix.has_ground_altitude_;
52 has_count_ = map_matrix.has_count_;
53 has_ground_count_ = map_matrix.has_ground_count_;
54}

成员函数说明

◆ AddGroundSample()

void apollo::localization::msf::pyramid_map::PyramidMapMatrix::AddGroundSample ( float  ground_altitude,
unsigned int  row,
unsigned int  col,
unsigned int  level = 0 
)

Add ground sample to the map cell.

在文件 pyramid_map_matrix.cc1432 行定义.

1433 {
1434 if (!CheckLegalityForGetData(row, col, level)) {
1435 AERROR << "PyramidMapMatrix: [AddGroundSample] Params is illegal.";
1436 return;
1437 }
1438
1439 if (has_ground_count_) {
1440 ++ground_count_matrixes_[level][row][col];
1441 }
1442
1443 float v1 = 0.0;
1444 float value = 0.0;
1445 if (has_ground_count_ && has_ground_altitude_) {
1446 v1 = ground_altitude - ground_altitude_matrixes_[level][row][col];
1447 value = v1 / static_cast<float>(ground_count_matrixes_[level][row][col]);
1448 ground_altitude_matrixes_[level][row][col] += value;
1449 }
1450}
#define AERROR
Definition log.h:44

◆ AddSampleBase()

void apollo::localization::msf::pyramid_map::PyramidMapMatrix::AddSampleBase ( float  intensity,
float  altitude,
unsigned int  row,
unsigned int  col,
unsigned int  level 
)
inline

Add sample to the map cell.

only update count, intensity, intensity var and altitude

在文件 pyramid_map_matrix.h402 行定义.

404 {
405 ++count_matrixes_[level][row][col];
406
407 float v1 = 0.0;
408 float v2 = 0.0;
409 float value = 0.0;
410
411 v1 = intensity - intensity_matrixes_[level][row][col];
412 value = v1 / static_cast<float>(count_matrixes_[level][row][col]);
413 intensity_matrixes_[level][row][col] += value;
414
415 v2 = intensity - intensity_matrixes_[level][row][col];
416 intensity_var_matrixes_[level][row][col] =
417 (static_cast<float>(count_matrixes_[level][row][col] - 1) *
418 intensity_var_matrixes_[level][row][col] +
419 v1 * v2) /
420 static_cast<float>(count_matrixes_[level][row][col]);
421
422 v1 = altitude - altitude_matrixes_[level][row][col];
423 value = v1 / static_cast<float>(count_matrixes_[level][row][col]);
424 altitude_matrixes_[level][row][col] += value;
425}

◆ AddSampleSafe()

void apollo::localization::msf::pyramid_map::PyramidMapMatrix::AddSampleSafe ( float  intensity,
float  altitude,
unsigned int  row,
unsigned int  col,
unsigned int  level 
)

Add sample to the map cell with check.

在文件 pyramid_map_matrix.cc1386 行定义.

1388 {
1389 if (!CheckLegalityForGetData(row, col, level)) {
1390 AERROR << "PyramidMapMatrix: [AddSampleSafe] Params is illegal.";
1391 return;
1392 }
1393
1394 if (has_count_) {
1395 ++count_matrixes_[level][row][col];
1396 }
1397
1398 float v1 = 0.0;
1399 float v2 = 0.0;
1400 float value = 0.0;
1401 if (has_count_ && has_intensity_) {
1402 v1 = intensity - intensity_matrixes_[level][row][col];
1403 value = v1 / static_cast<float>(count_matrixes_[level][row][col]);
1404 intensity_matrixes_[level][row][col] += value;
1405 }
1406
1407 if (has_count_ && has_intensity_ && has_intensity_var_) {
1408 v2 = intensity - intensity_matrixes_[level][row][col];
1409 intensity_var_matrixes_[level][row][col] =
1410 (static_cast<float>(count_matrixes_[level][row][col] - 1) *
1411 intensity_var_matrixes_[level][row][col] +
1412 v1 * v2) /
1413 static_cast<float>(count_matrixes_[level][row][col]);
1414 }
1415
1416 if (has_count_ && has_altitude_) {
1417 v1 = altitude - altitude_matrixes_[level][row][col];
1418 value = v1 / static_cast<float>(count_matrixes_[level][row][col]);
1419 altitude_matrixes_[level][row][col] += value;
1420 }
1421
1422 if (has_count_ && has_altitude_ && has_altitude_var_) {
1423 v2 = altitude - altitude_matrixes_[level][row][col];
1424 altitude_var_matrixes_[level][row][col] =
1425 (static_cast<float>(count_matrixes_[level][row][col] - 1) *
1426 altitude_var_matrixes_[level][row][col] +
1427 v1 * v2) /
1428 static_cast<float>(count_matrixes_[level][row][col]);
1429 }
1430}

◆ BottomUpBase()

void apollo::localization::msf::pyramid_map::PyramidMapMatrix::BottomUpBase ( )

Propagate the data from fine level to the coarse resolution by check.

only update count, intensity, intensity var and altitude

在文件 pyramid_map_matrix.cc404 行定义.

404 {
405 for (unsigned int i = 1; i < resolution_num_; ++i) {
406 const unsigned int& row = rows_mr_[i];
407 const unsigned int& col = rows_mr_[i];
408 for (unsigned int r = 0; r < row; ++r) {
409 for (unsigned int c = 0; c < col; ++c) {
410 unsigned int& r0 = ratio_multiplier_[r];
411 unsigned int& c0 = ratio_multiplier_[c];
412 for (unsigned int rl = r0; rl < r0 + ratio_; ++rl) {
413 for (unsigned int cl = c0; cl < c0 + ratio_; ++cl) {
414 const unsigned int& count = count_matrixes_[i - 1][rl][cl];
415 if (count > 0) {
416 float* intensity = nullptr;
417 float* intensity_var = nullptr;
418 float* altitude = nullptr;
419 unsigned int* count = nullptr;
420
421 GetMapCellBase(&intensity, &intensity_var, &altitude, &count, rl,
422 cl, i - 1);
423 MergeCellBase(intensity, intensity_var, altitude, count, r, c, i);
424 }
425 }
426 }
427 }
428 }
429 }
430}
void GetMapCellBase(float **intensity, float **intensity_var, float **altitude, unsigned int **count, unsigned int row, unsigned int col, unsigned int level=0)
Get cell values.
void MergeCellBase(const float *intensity, const float *intensity_var, const float *altitude, const unsigned int *count, unsigned int row, unsigned int col, unsigned int level)
Merge the data from another map cell.

◆ BottomUpSafe()

void apollo::localization::msf::pyramid_map::PyramidMapMatrix::BottomUpSafe ( )

Propagate the data from fine level to the coarse resolution by check.

在文件 pyramid_map_matrix.cc366 行定义.

366 {
367 if (!has_count_) {
368 AERROR << "PyramidMapMatrix: [bottom_up] Has no count.";
369 return;
370 }
371
372 for (unsigned int i = 1; i < resolution_num_; ++i) {
373 const unsigned int& row = rows_mr_[i];
374 const unsigned int& col = rows_mr_[i];
375 for (unsigned int r = 0; r < row; ++r) {
376 for (unsigned int c = 0; c < col; ++c) {
377 unsigned int& r0 = ratio_multiplier_[r];
378 unsigned int& c0 = ratio_multiplier_[c];
379 for (unsigned int rl = r0; rl < r0 + ratio_; ++rl) {
380 for (unsigned int cl = c0; cl < c0 + ratio_; ++cl) {
381 const unsigned int& count = count_matrixes_[i - 1][rl][cl];
382 if (count > 0) {
383 float* intensity = nullptr;
384 float* intensity_var = nullptr;
385 float* altitude = nullptr;
386 float* altitude_var = nullptr;
387 float* ground_altitude = nullptr;
388 unsigned int* count = nullptr;
389 unsigned int* ground_count = nullptr;
390
391 GetMapCellSafe(&intensity, &intensity_var, &altitude,
392 &altitude_var, &ground_altitude, &count,
393 &ground_count, rl, cl, i - 1);
394 MergeCellSafe(intensity, intensity_var, altitude, altitude_var,
395 ground_altitude, count, ground_count, r, c, i);
396 }
397 }
398 }
399 }
400 }
401 }
402}
void GetMapCellSafe(float **intensity, float **intensity_var, float **altitude, float **altitude_var, float **ground_altitude, unsigned int **count, unsigned int **ground_count, unsigned int row, unsigned int col, unsigned int level=0)
Get cell values by check.
void MergeCellSafe(const float *intensity, const float *intensity_var, const float *altitude, const float *altitude_var, const float *ground_altitude, const unsigned int *count, const unsigned int *ground_count, unsigned int row, unsigned int col, unsigned int level)
Merge the data from another map cell by check.

◆ Clear()

void apollo::localization::msf::pyramid_map::PyramidMapMatrix::Clear ( )

Release all memory in PyramidMapMatrix.

在文件 pyramid_map_matrix.cc254 行定义.

254 {
255 resolution_num_ = 1;
256 ratio_ = 2;
257
258 has_intensity_ = false;
259 has_intensity_var_ = false;
260 has_altitude_ = false;
261 has_altitude_var_ = false;
262 has_ground_altitude_ = false;
263 has_count_ = false;
264 has_ground_count_ = false;
265
266 rows_mr_.clear();
267 cols_mr_.clear();
268 ratio_multiplier_.clear();
269 intensity_matrixes_.clear();
270 intensity_var_matrixes_.clear();
271 altitude_matrixes_.clear();
272 altitude_var_matrixes_.clear();
273 ground_altitude_matrixes_.clear();
274 count_matrixes_.clear();
275 ground_count_matrixes_.clear();
276}

◆ ComputeMeanIntensity()

double apollo::localization::msf::pyramid_map::PyramidMapMatrix::ComputeMeanIntensity ( unsigned int  level = 0)

Compute mean intensity.

在文件 pyramid_map_matrix.cc1452 行定义.

1452 {
1453 if (!has_count_) {
1454 AERROR << "PyramidMapMatrix: [ComputeMeanIntensity] Has no count.";
1455 return 0.0;
1456 }
1457
1458 if (!has_intensity_ || resolution_num_ < 1) {
1459 AERROR << "PyramidMapMatrix: [ComputeMeanIntensity] No intensity data.";
1460 return 0.0;
1461 }
1462
1463 if (level >= resolution_num_) {
1464 AERROR
1465 << "PyramidMapMatrix: [ComputeMeanIntensity] The level id is illegal.";
1466 return 0.0;
1467 }
1468
1469 double avg = 0.0;
1470 int count = 0;
1471 for (unsigned int y = 0; y < rows_mr_[level]; ++y) {
1472 for (unsigned int x = 0; x < cols_mr_[level]; ++x) {
1473 if (count_matrixes_[level][y][x] > 0) {
1474 ++count;
1475 double delta = intensity_matrixes_[level][y][x] - avg;
1476 avg += (delta / count);
1477 }
1478 }
1479 }
1480
1481 return avg;
1482}

◆ GetAltitude()

const float * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetAltitude ( unsigned int  row,
unsigned int  col,
unsigned int  level = 0 
) const
inline

Get an altitude value without check.

在文件 pyramid_map_matrix.h476 行定义.

478 {
479 return &altitude_matrixes_[level][row][col];
480}

◆ GetAltitudeImg() [1/2]

bool apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetAltitudeImg ( cv::Mat *  altitude_img) const
virtual

get altitude image of node.

重载 apollo::localization::msf::pyramid_map::BaseMapMatrix .

在文件 pyramid_map_matrix.cc312 行定义.

312 {
313 return GetAltitudeImg(0, altitude_img);
314}
virtual bool GetAltitudeImg(cv::Mat *altitude_img) const
get altitude image of node.

◆ GetAltitudeImg() [2/2]

bool apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetAltitudeImg ( unsigned int  level,
cv::Mat *  altitude_img 
) const

在文件 pyramid_map_matrix.cc316 行定义.

317 {
318 if (!has_altitude_ || resolution_num_ < 1) {
319 AERROR << "PyramidMapMatrix: [GetAltitudeImg] No altitude data.";
320 return false;
321 }
322
323 if (level >= resolution_num_) {
324 AERROR << "PyramidMapMatrix: [GetAltitudeImg] The level id is illegal.";
325 return false;
326 }
327
328 float min_alt = 1e8;
329 float max_alt = -1e8;
330
331 for (unsigned int y = 0; y < rows_mr_[level]; y++) {
332 for (unsigned int x = 0; x < cols_mr_[level]; x++) {
333 if (count_matrixes_[level][y][x] > 0) {
334 if (altitude_matrixes_[level][y][x] > max_alt) {
335 max_alt = altitude_matrixes_[level][y][x];
336 }
337 if (altitude_matrixes_[level][y][x] < min_alt) {
338 min_alt = altitude_matrixes_[level][y][x];
339 }
340 }
341 }
342 }
343
344 *altitude_img = cv::Mat(cv::Size(cols_mr_[level], rows_mr_[level]), CV_8UC1);
345 for (unsigned int y = 0; y < rows_mr_[level]; y++) {
346 for (unsigned int x = 0; x < cols_mr_[level]; x++) {
347 if (count_matrixes_[level][y][x] > 0) {
348 if (altitude_matrixes_[level][y][x] >= max_alt) {
349 altitude_img->at<unsigned char>(y, x) = 255;
350 } else if (altitude_matrixes_[level][y][x] <= min_alt) {
351 altitude_img->at<unsigned char>(y, x) = 0;
352 } else {
353 altitude_img->at<unsigned char>(y, x) = static_cast<unsigned char>(
354 (altitude_matrixes_[level][y][x] - min_alt) /
355 (max_alt - min_alt) * 255);
356 }
357 } else {
358 altitude_img->at<unsigned char>(y, x) = 0;
359 }
360 }
361 }
362
363 return true;
364}

◆ GetAltitudeMatrix() [1/2]

FloatMatrix * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetAltitudeMatrix ( unsigned int  level = 0)
inline

在文件 pyramid_map_matrix.h512 行定义.

512 {
513 return &altitude_matrixes_[level];
514}

◆ GetAltitudeMatrix() [2/2]

const FloatMatrix * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetAltitudeMatrix ( unsigned int  level = 0) const
inline

在文件 pyramid_map_matrix.h543 行定义.

544 {
545 return &altitude_matrixes_[level];
546}

◆ GetAltitudeMatrixSafe() [1/2]

FloatMatrix * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetAltitudeMatrixSafe ( unsigned int  level = 0)

在文件 pyramid_map_matrix.cc643 行定义.

643 {
644 if (!has_altitude_) {
645 AERROR << "PyramidMapMatrix: [GetAltitudeMatrixSafe] Has no altitude.";
646 return nullptr;
647 }
648
649 if (level >= resolution_num_) {
650 AERROR
651 << "PyramidMapMatrix: [GetAltitudeMatrixSafe] The level id is illegal.";
652 return nullptr;
653 }
654
655 return &altitude_matrixes_[level];
656}

◆ GetAltitudeMatrixSafe() [2/2]

const FloatMatrix * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetAltitudeMatrixSafe ( unsigned int  level = 0) const

在文件 pyramid_map_matrix.cc753 行定义.

754 {
755 if (!has_altitude_) {
756 AERROR << "PyramidMapMatrix: [GetAltitudeMatrixSafe] Has no altitude.";
757 return nullptr;
758 }
759
760 if (level >= resolution_num_) {
761 AERROR
762 << "PyramidMapMatrix: [GetAltitudeMatrixSafe] The level id is illegal.";
763 return nullptr;
764 }
765
766 return &altitude_matrixes_[level];
767}

◆ GetAltitudeSafe()

const float * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetAltitudeSafe ( unsigned int  row,
unsigned int  col,
unsigned int  level = 0 
) const

Get an altitude value by check.

在文件 pyramid_map_matrix.cc491 行定义.

493 {
494 if (!has_altitude_) {
495 AERROR << "PyramidMapMatrix: [GetAltitudeSafe] Has no altitude.";
496 return nullptr;
497 }
498
499 if (!CheckLegalityForGetData(row, col, level)) {
500 AERROR << "PyramidMapMatrix: [GetAltitudeSafe] Params is illegal.";
501 return nullptr;
502 }
503
504 return &altitude_matrixes_[level][row][col];
505}

◆ GetAltitudeVar()

const float * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetAltitudeVar ( unsigned int  row,
unsigned int  col,
unsigned int  level = 0 
) const
inline

Get an altitude variance value without check.

在文件 pyramid_map_matrix.h482 行定义.

484 {
485 return &altitude_var_matrixes_[level][row][col];
486}

◆ GetAltitudeVarMatrix() [1/2]

FloatMatrix * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetAltitudeVarMatrix ( unsigned int  level = 0)
inline

在文件 pyramid_map_matrix.h516 行定义.

516 {
517 return &altitude_var_matrixes_[level];
518}

◆ GetAltitudeVarMatrix() [2/2]

const FloatMatrix * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetAltitudeVarMatrix ( unsigned int  level = 0) const
inline

在文件 pyramid_map_matrix.h548 行定义.

549 {
550 return &altitude_var_matrixes_[level];
551}

◆ GetAltitudeVarMatrixSafe() [1/2]

FloatMatrix * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetAltitudeVarMatrixSafe ( unsigned int  level = 0)

在文件 pyramid_map_matrix.cc658 行定义.

658 {
659 if (!has_altitude_var_) {
660 AERROR
661 << "PyramidMapMatrix: [GetAltitudeVarMatrixSafe] Has no altitude_var.";
662 return nullptr;
663 }
664
665 if (level >= resolution_num_) {
666 AERROR << "PyramidMapMatrix: [GetAltitudeVarMatrixSafe] The level id is "
667 "illegal.";
668 return nullptr;
669 }
670
671 return &altitude_var_matrixes_[level];
672}

◆ GetAltitudeVarMatrixSafe() [2/2]

const FloatMatrix * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetAltitudeVarMatrixSafe ( unsigned int  level = 0) const

在文件 pyramid_map_matrix.cc769 行定义.

770 {
771 if (!has_altitude_var_) {
772 AERROR
773 << "PyramidMapMatrix: [GetAltitudeVarMatrixSafe] Has no altitude_var.";
774 return nullptr;
775 }
776
777 if (level >= resolution_num_) {
778 AERROR << "PyramidMapMatrix: [GetAltitudeVarMatrixSafe] The level id is "
779 "illegal.";
780 return nullptr;
781 }
782
783 return &altitude_var_matrixes_[level];
784}

◆ GetAltitudeVarSafe()

const float * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetAltitudeVarSafe ( unsigned int  row,
unsigned int  col,
unsigned int  level = 0 
) const

Get an altitude variance value by check.

在文件 pyramid_map_matrix.cc507 行定义.

509 {
510 if (!has_altitude_var_) {
511 AERROR << "PyramidMapMatrix: [GetAltitudeVarSafe] Has no altitude_var.";
512 return nullptr;
513 }
514
515 if (!CheckLegalityForGetData(row, col, level)) {
516 AERROR << "PyramidMapMatrix: [get_altitude_var] Params is illegal.";
517 return nullptr;
518 }
519
520 return &altitude_var_matrixes_[level][row][col];
521}

◆ GetCols()

unsigned int apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetCols ( unsigned int  level = 0) const
inline

Get column number given the resolution.

在文件 pyramid_map_matrix.h390 行定义.

390 {
391 return cols_mr_[level];
392}

◆ GetColsSafe()

unsigned int apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetColsSafe ( unsigned int  level = 0) const
inline

Get column number given the resolution by check.

在文件 pyramid_map_matrix.h376 行定义.

376 {
377 if (level >= resolution_num_) {
378 std::cerr << "PyramidMapMatrix: [GetCols] The level id is illegal."
379 << std::endl;
380 return 0;
381 }
382
383 return cols_mr_[level];
384}

◆ GetCount()

const unsigned int * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetCount ( unsigned int  row,
unsigned int  col,
unsigned int  level = 0 
) const
inline

Get a count value without check.

在文件 pyramid_map_matrix.h493 行定义.

494 {
495 return &count_matrixes_[level][row][col];
496}

◆ GetCountMatrix() [1/2]

UIntMatrix * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetCountMatrix ( unsigned int  level = 0)
inline

在文件 pyramid_map_matrix.h525 行定义.

525 {
526 return &count_matrixes_[level];
527}

◆ GetCountMatrix() [2/2]

const UIntMatrix * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetCountMatrix ( unsigned int  level = 0) const
inline

在文件 pyramid_map_matrix.h558 行定义.

559 {
560 return &count_matrixes_[level];
561}

◆ GetCountMatrixSafe() [1/2]

UIntMatrix * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetCountMatrixSafe ( unsigned int  level = 0)

在文件 pyramid_map_matrix.cc690 行定义.

690 {
691 if (!has_count_) {
692 AERROR << "PyramidMapMatrix: [GetCountMatrixSafe] Has no count.";
693 return nullptr;
694 }
695
696 if (level >= resolution_num_) {
697 AERROR << "PyramidMapMatrix: [GetCountMatrixSafe] The level id is illegal.";
698 return nullptr;
699 }
700
701 return &count_matrixes_[level];
702}

◆ GetCountMatrixSafe() [2/2]

const UIntMatrix * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetCountMatrixSafe ( unsigned int  level = 0) const

在文件 pyramid_map_matrix.cc803 行定义.

804 {
805 if (!has_count_) {
806 AERROR << "PyramidMapMatrix: [GetCountMatrixSafe] Has no count.";
807 return nullptr;
808 }
809
810 if (level >= resolution_num_) {
811 AERROR << "PyramidMapMatrix: [GetCountMatrixSafe] The level id is illegal.";
812 return nullptr;
813 }
814
815 return &count_matrixes_[level];
816}

◆ GetCountSafe()

const unsigned int * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetCountSafe ( unsigned int  row,
unsigned int  col,
unsigned int  level = 0 
) const

Get a count value by check.

在文件 pyramid_map_matrix.cc540 行定义.

542 {
543 if (!has_count_) {
544 AERROR << "PyramidMapMatrix: [GetCountSafe] Has no count.";
545 return nullptr;
546 }
547
548 if (!CheckLegalityForGetData(row, col, level)) {
549 AERROR << "PyramidMapMatrix: [GetCountSafe] Params is illegal.";
550 return nullptr;
551 }
552
553 return &count_matrixes_[level][row][col];
554}

◆ GetGroundAltitude()

const float * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetGroundAltitude ( unsigned int  row,
unsigned int  col,
unsigned int  level = 0 
) const
inline

Get an altitude ground value without check.

在文件 pyramid_map_matrix.h488 行定义.

489 {
490 return &ground_altitude_matrixes_[level][row][col];
491}

◆ GetGroundAltitudeMatrix() [1/2]

FloatMatrix * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetGroundAltitudeMatrix ( unsigned int  level = 0)
inline

在文件 pyramid_map_matrix.h520 行定义.

521 {
522 return &ground_altitude_matrixes_[level];
523}

◆ GetGroundAltitudeMatrix() [2/2]

const FloatMatrix * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetGroundAltitudeMatrix ( unsigned int  level = 0) const
inline

在文件 pyramid_map_matrix.h553 行定义.

554 {
555 return &ground_altitude_matrixes_[level];
556}

◆ GetGroundAltitudeMatrixSafe() [1/2]

FloatMatrix * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetGroundAltitudeMatrixSafe ( unsigned int  level = 0)

在文件 pyramid_map_matrix.cc674 行定义.

674 {
675 if (!has_ground_altitude_) {
676 AERROR << "PyramidMapMatrix: [GetGroundAltitudeMatrixSafe] Has no "
677 "ground_altitude.";
678 return nullptr;
679 }
680
681 if (level >= resolution_num_) {
682 AERROR << "PyramidMapMatrix: [GetGroundAltitudeMatrixSafe] The level id "
683 "is illegal.";
684 return nullptr;
685 }
686
687 return &ground_altitude_matrixes_[level];
688}

◆ GetGroundAltitudeMatrixSafe() [2/2]

const FloatMatrix * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetGroundAltitudeMatrixSafe ( unsigned int  level = 0) const

在文件 pyramid_map_matrix.cc786 行定义.

787 {
788 if (!has_ground_altitude_) {
789 AERROR << "PyramidMapMatrix: [GetGroundAltitudeMatrixSafe] Has no "
790 "ground_altitude.";
791 return nullptr;
792 }
793
794 if (level >= resolution_num_) {
795 AERROR << "PyramidMapMatrix: [GetGroundAltitudeMatrixSafe] The level id "
796 "is illegal.";
797 return nullptr;
798 }
799
800 return &ground_altitude_matrixes_[level];
801}

◆ GetGroundAltitudeSafe()

const float * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetGroundAltitudeSafe ( unsigned int  row,
unsigned int  col,
unsigned int  level = 0 
) const

Get an altitude ground value by check.

在文件 pyramid_map_matrix.cc523 行定义.

525 {
526 if (!has_ground_altitude_) {
527 AERROR
528 << "PyramidMapMatrix: [GetGroundAltitudeSafe] Has no ground_altitude.";
529 return nullptr;
530 }
531
532 if (!CheckLegalityForGetData(row, col, level)) {
533 AERROR << "PyramidMapMatrix: [GetGroundAltitudeSafe] Params is illegal.";
534 return nullptr;
535 }
536
537 return &ground_altitude_matrixes_[level][row][col];
538}

◆ GetGroundCount()

const unsigned int * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetGroundCount ( unsigned int  row,
unsigned int  col,
unsigned int  level = 0 
) const
inline

Get a ground count value without check.

在文件 pyramid_map_matrix.h498 行定义.

499 {
500 return &ground_count_matrixes_[level][row][col];
501}

◆ GetGroundCountMatrix() [1/2]

UIntMatrix * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetGroundCountMatrix ( unsigned int  level = 0)
inline

在文件 pyramid_map_matrix.h529 行定义.

529 {
530 return &ground_count_matrixes_[level];
531}

◆ GetGroundCountMatrix() [2/2]

const UIntMatrix * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetGroundCountMatrix ( unsigned int  level = 0) const
inline

在文件 pyramid_map_matrix.h563 行定义.

564 {
565 return &ground_count_matrixes_[level];
566}

◆ GetGroundCountMatrixSafe() [1/2]

UIntMatrix * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetGroundCountMatrixSafe ( unsigned int  level = 0)

在文件 pyramid_map_matrix.cc704 行定义.

704 {
705 if (!has_ground_count_) {
706 AERROR
707 << "PyramidMapMatrix: [GetGroundCountMatrixSafe] Has no ground_count.";
708 return nullptr;
709 }
710
711 if (level >= resolution_num_) {
712 AERROR << "PyramidMapMatrix: [GetGroundCountMatrixSafe] The level id is "
713 "illegal.";
714 return nullptr;
715 }
716
717 return &ground_count_matrixes_[level];
718}

◆ GetGroundCountMatrixSafe() [2/2]

const UIntMatrix * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetGroundCountMatrixSafe ( unsigned int  level = 0) const

在文件 pyramid_map_matrix.cc818 行定义.

819 {
820 if (!has_ground_count_) {
821 AERROR
822 << "PyramidMapMatrix: [GetGroundCountMatrixSafe] Has no ground_count.";
823 return nullptr;
824 }
825
826 if (level >= resolution_num_) {
827 AERROR << "PyramidMapMatrix: [GetGroundCountMatrixSafe] The level id is "
828 "illegal.";
829 return nullptr;
830 }
831
832 return &ground_count_matrixes_[level];
833}

◆ GetGroundCountSafe()

const unsigned int * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetGroundCountSafe ( unsigned int  row,
unsigned int  col,
unsigned int  level = 0 
) const

Get a ground count value by check.

在文件 pyramid_map_matrix.cc556 行定义.

557 {
558 if (!has_ground_count_) {
559 AERROR << "PyramidMapMatrix: [GetGroundCountSafe] Has no ground_count.";
560 return nullptr;
561 }
562
563 if (!CheckLegalityForGetData(row, col, level)) {
564 AERROR << "PyramidMapMatrix: [GetGroundCountSafe] Params is illegal.";
565 return nullptr;
566 }
567
568 return &ground_count_matrixes_[level][row][col];
569}

◆ GetIntensity()

const float * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetIntensity ( unsigned int  row,
unsigned int  col,
unsigned int  level = 0 
) const
inline

Get an intensity value without check.

在文件 pyramid_map_matrix.h465 行定义.

467 {
468 return &intensity_matrixes_[level][row][col];
469}

◆ GetIntensityImg() [1/2]

bool apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetIntensityImg ( cv::Mat *  intensity_img) const
virtual

get intensity image of node.

重载 apollo::localization::msf::pyramid_map::BaseMapMatrix .

在文件 pyramid_map_matrix.cc278 行定义.

278 {
279 return GetIntensityImg(0, intensity_img);
280}
virtual bool GetIntensityImg(cv::Mat *intensity_img) const
get intensity image of node.

◆ GetIntensityImg() [2/2]

bool apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetIntensityImg ( unsigned int  level,
cv::Mat *  intensity_img 
) const

在文件 pyramid_map_matrix.cc282 行定义.

283 {
284 if (!has_intensity_ || resolution_num_ < 1) {
285 AERROR << "PyramidMapMatrix: [GetIntensityImg] No intensity data.";
286 return false;
287 }
288
289 if (level >= resolution_num_) {
290 AERROR << "PyramidMapMatrix: [GetIntensityImg] The level id is illegal.";
291 return false;
292 }
293
294 *intensity_img = cv::Mat(cv::Size(cols_mr_[level], rows_mr_[level]), CV_8UC1);
295
296 for (unsigned int y = 0; y < rows_mr_[level]; ++y) {
297 for (unsigned int x = 0; x < cols_mr_[level]; ++x) {
298 if (intensity_matrixes_[level][y][x] < 0) {
299 intensity_img->at<unsigned char>(y, x) = 0;
300 } else if (intensity_matrixes_[level][y][x] > 255) {
301 intensity_img->at<unsigned char>(y, x) = 255;
302 } else {
303 intensity_img->at<unsigned char>(y, x) =
304 static_cast<unsigned char>(intensity_matrixes_[level][y][x]);
305 }
306 }
307 }
308
309 return true;
310}

◆ GetIntensityMatrix() [1/2]

FloatMatrix * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetIntensityMatrix ( unsigned int  level = 0)
inline

在文件 pyramid_map_matrix.h503 行定义.

503 {
504 return &intensity_matrixes_[level];
505}

◆ GetIntensityMatrix() [2/2]

const FloatMatrix * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetIntensityMatrix ( unsigned int  level = 0) const
inline

在文件 pyramid_map_matrix.h533 行定义.

534 {
535 return &intensity_matrixes_[level];
536}

◆ GetIntensityMatrixSafe() [1/2]

FloatMatrix * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetIntensityMatrixSafe ( unsigned int  level = 0)

在文件 pyramid_map_matrix.cc612 行定义.

612 {
613 if (!has_intensity_) {
614 AERROR << "PyramidMapMatrix: [GetIntensityMatrixSafe] Has no intensity.";
615 return nullptr;
616 }
617
618 if (level >= resolution_num_) {
619 AERROR << "PyramidMapMatrix: [GetIntensityMatrixSafe] The level id is "
620 "illegal.";
621 return nullptr;
622 }
623
624 return &intensity_matrixes_[level];
625}

◆ GetIntensityMatrixSafe() [2/2]

const FloatMatrix * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetIntensityMatrixSafe ( unsigned int  level = 0) const

在文件 pyramid_map_matrix.cc720 行定义.

721 {
722 if (!has_intensity_) {
723 AERROR << "PyramidMapMatrix: [GetIntensityMatrixSafe] Has no intensity.";
724 return nullptr;
725 }
726
727 if (level >= resolution_num_) {
728 AERROR << "PyramidMapMatrix: [GetIntensityMatrixSafe] The level id is "
729 "illegal.";
730 return nullptr;
731 }
732
733 return &intensity_matrixes_[level];
734}

◆ GetIntensitySafe()

const float * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetIntensitySafe ( unsigned int  row,
unsigned int  col,
unsigned int  level = 0 
) const

Get an intensity value by check.

在文件 pyramid_map_matrix.cc459 行定义.

461 {
462 if (!has_intensity_) {
463 AERROR << "PyramidMapMatrix: [GetIntensitySafe] Has no intensity.";
464 return nullptr;
465 }
466
467 if (!CheckLegalityForGetData(row, col, level)) {
468 AERROR << "PyramidMapMatrix: [GetIntensitySafe] Params is illegal.";
469 return nullptr;
470 }
471
472 return &intensity_matrixes_[level][row][col];
473}

◆ GetIntensityVar()

const float * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetIntensityVar ( unsigned int  row,
unsigned int  col,
unsigned int  level = 0 
) const
inline

Get an intensity variance value by check.

在文件 pyramid_map_matrix.h471 行定义.

472 {
473 return &intensity_var_matrixes_[level][row][col];
474}

◆ GetIntensityVarMatrix() [1/2]

FloatMatrix * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetIntensityVarMatrix ( unsigned int  level = 0)
inline

在文件 pyramid_map_matrix.h507 行定义.

508 {
509 return &intensity_var_matrixes_[level];
510}

◆ GetIntensityVarMatrix() [2/2]

const FloatMatrix * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetIntensityVarMatrix ( unsigned int  level = 0) const
inline

在文件 pyramid_map_matrix.h538 行定义.

539 {
540 return &intensity_var_matrixes_[level];
541}

◆ GetIntensityVarMatrixSafe() [1/2]

FloatMatrix * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetIntensityVarMatrixSafe ( unsigned int  level = 0)

在文件 pyramid_map_matrix.cc627 行定义.

627 {
628 if (!has_intensity_var_) {
629 AERROR << "PyramidMapMatrix: [GetIntensityVarMatrixSafe] Has no "
630 "intensity_var.";
631 return nullptr;
632 }
633
634 if (level >= resolution_num_) {
635 AERROR << "PyramidMapMatrix: [GetIntensityVarMatrixSafe] The level id "
636 "is illegal.";
637 return nullptr;
638 }
639
640 return &intensity_var_matrixes_[level];
641}

◆ GetIntensityVarMatrixSafe() [2/2]

const FloatMatrix * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetIntensityVarMatrixSafe ( unsigned int  level = 0) const

在文件 pyramid_map_matrix.cc736 行定义.

737 {
738 if (!has_intensity_var_) {
739 AERROR << "PyramidMapMatrix: [GetIntensityVarMatrixSafe] Has no "
740 "intensity_var.";
741 return nullptr;
742 }
743
744 if (level >= resolution_num_) {
745 AERROR << "PyramidMapMatrix: [GetIntensityVarMatrixSafe] The level id "
746 "is illegal.";
747 return nullptr;
748 }
749
750 return &intensity_var_matrixes_[level];
751}

◆ GetIntensityVarSafe()

const float * apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetIntensityVarSafe ( unsigned int  row,
unsigned int  col,
unsigned int  level = 0 
) const

Get an intensity variance value by check.

在文件 pyramid_map_matrix.cc475 行定义.

477 {
478 if (!has_intensity_var_) {
479 AERROR << "PyramidMapMatrix: [GetIntensityVarSafe] Has no intensity_var.";
480 return nullptr;
481 }
482
483 if (!CheckLegalityForGetData(row, col, level)) {
484 AERROR << "PyramidMapMatrix: [GetIntensityVarSafe] Params is illegal.";
485 return nullptr;
486 }
487
488 return &intensity_var_matrixes_[level][row][col];
489}

◆ GetMapCellBase()

void apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetMapCellBase ( float **  intensity,
float **  intensity_var,
float **  altitude,
unsigned int **  count,
unsigned int  row,
unsigned int  col,
unsigned int  level = 0 
)
inline

Get cell values.

just get count, intensity, intensity var and altitude

在文件 pyramid_map_matrix.h453 行定义.

458 {
459 *intensity = &intensity_matrixes_[level][row][col];
460 *intensity_var = &intensity_var_matrixes_[level][row][col];
461 *altitude = &altitude_matrixes_[level][row][col];
462 *count = &count_matrixes_[level][row][col];
463}

◆ GetMapCellSafe()

void apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetMapCellSafe ( float **  intensity,
float **  intensity_var,
float **  altitude,
float **  altitude_var,
float **  ground_altitude,
unsigned int **  count,
unsigned int **  ground_count,
unsigned int  row,
unsigned int  col,
unsigned int  level = 0 
)

Get cell values by check.

在文件 pyramid_map_matrix.cc571 行定义.

577 {
578 if (!CheckLegalityForGetData(row, col, level)) {
579 AERROR << "PyramidMapMatrix: [GetMapCellSafe] Params is illegal.";
580 return;
581 }
582
583 if (has_intensity_) {
584 *intensity = &intensity_matrixes_[level][row][col];
585 }
586
587 if (has_intensity_var_) {
588 *intensity_var = &intensity_var_matrixes_[level][row][col];
589 }
590
591 if (has_altitude_) {
592 *altitude = &altitude_matrixes_[level][row][col];
593 }
594
595 if (has_altitude_var_) {
596 *altitude_var = &altitude_var_matrixes_[level][row][col];
597 }
598
599 if (has_ground_altitude_) {
600 *ground_altitude = &ground_altitude_matrixes_[level][row][col];
601 }
602
603 if (has_count_) {
604 *count = &count_matrixes_[level][row][col];
605 }
606
607 if (has_ground_count_) {
608 *ground_count = &ground_count_matrixes_[level][row][col];
609 }
610}

◆ GetResolutionNum()

unsigned int apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetResolutionNum ( ) const
inline

Get number of resolution.

在文件 pyramid_map_matrix.h394 行定义.

394 {
395 return resolution_num_;
396}

◆ GetResolutionRatio()

unsigned int apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetResolutionRatio ( ) const
inline

Get the resolution ratio.

在文件 pyramid_map_matrix.h398 行定义.

398 {
399 return ratio_;
400}

◆ GetRows()

unsigned int apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetRows ( unsigned int  level = 0) const
inline

Get row number given the resolution.

在文件 pyramid_map_matrix.h386 行定义.

386 {
387 return rows_mr_[level];
388}

◆ GetRowsSafe()

unsigned int apollo::localization::msf::pyramid_map::PyramidMapMatrix::GetRowsSafe ( unsigned int  level = 0) const
inline

Get row number given the resolution by check.

在文件 pyramid_map_matrix.h366 行定义.

366 {
367 if (level >= resolution_num_) {
368 std::cerr << "PyramidMapMatrix: [GetRows] The level id is illegal."
369 << std::endl;
370 return 0;
371 }
372
373 return rows_mr_[level];
374}

◆ HasAltitude()

bool apollo::localization::msf::pyramid_map::PyramidMapMatrix::HasAltitude ( ) const
inline

在文件 pyramid_map_matrix.h350 行定义.

350{ return has_altitude_; }

◆ HasAltitudeVar()

bool apollo::localization::msf::pyramid_map::PyramidMapMatrix::HasAltitudeVar ( ) const
inline

在文件 pyramid_map_matrix.h352 行定义.

352 {
353 return has_altitude_var_;
354}

◆ HasCount()

bool apollo::localization::msf::pyramid_map::PyramidMapMatrix::HasCount ( ) const
inline

在文件 pyramid_map_matrix.h360 行定义.

360{ return has_count_; }

◆ HasGroundAltitude()

bool apollo::localization::msf::pyramid_map::PyramidMapMatrix::HasGroundAltitude ( ) const
inline

在文件 pyramid_map_matrix.h356 行定义.

356 {
357 return has_ground_altitude_;
358}

◆ HasGroundCount()

bool apollo::localization::msf::pyramid_map::PyramidMapMatrix::HasGroundCount ( ) const
inline

在文件 pyramid_map_matrix.h362 行定义.

362 {
363 return has_ground_count_;
364}

◆ HasIntensity()

bool apollo::localization::msf::pyramid_map::PyramidMapMatrix::HasIntensity ( ) const
inline

在文件 pyramid_map_matrix.h344 行定义.

344{ return has_intensity_; }

◆ HasIntensityVar()

bool apollo::localization::msf::pyramid_map::PyramidMapMatrix::HasIntensityVar ( ) const
inline

在文件 pyramid_map_matrix.h346 行定义.

346 {
347 return has_intensity_var_;
348}

◆ Init() [1/2]

void apollo::localization::msf::pyramid_map::PyramidMapMatrix::Init ( const BaseMapConfig config)
virtual

Initialize the map matrix.

实现了 apollo::localization::msf::pyramid_map::BaseMapMatrix.

在文件 pyramid_map_matrix.cc56 行定义.

56 {
57 const PyramidMapConfig* pconfig =
58 dynamic_cast<const PyramidMapConfig*>(&config);
59 Init(pconfig->map_node_size_y_, pconfig->map_node_size_x_,
60 pconfig->has_intensity_, pconfig->has_intensity_var_,
61 pconfig->has_altitude_, pconfig->has_altitude_var_,
62 pconfig->has_ground_altitude_, pconfig->has_count_,
63 pconfig->has_ground_count_, pconfig->resolution_num_,
64 pconfig->resolution_ratio_);
65}
virtual void Init(const BaseMapConfig &config)
Initialize the map matrix.

◆ Init() [2/2]

void apollo::localization::msf::pyramid_map::PyramidMapMatrix::Init ( unsigned int  rows,
unsigned int  cols,
bool  has_intensity = true,
bool  has_intensity_var = true,
bool  has_altitude = true,
bool  has_altitude_var = true,
bool  has_ground_altitude = true,
bool  has_count = true,
bool  has_ground_count = true,
unsigned int  resolution_num = 1,
unsigned int  ratio = 2 
)

在文件 pyramid_map_matrix.cc73 行定义.

78 {
79 Clear();
80
81 // resolution_num should greater than 0
82 if (resolution_num < 1) {
83 AERROR
84 << "PyramidMapMatrix: [init] The resolution_num should greater than 0.";
85 return;
86 }
87
88 // ratio should greater than 0
89 if (ratio < 1) {
90 AERROR << "PyramidMapMatrix: [init] The ratio should greater than 0.";
91 return;
92 }
93
94 // rows and cols in each level should be divisible by ratio
95 unsigned int rows_tem = rows;
96 unsigned int cols_tem = cols;
97 for (unsigned int i = 1; i < resolution_num_; ++i) {
98 unsigned int rows_remainder = rows_tem % ratio;
99 unsigned int cols_remainder = cols_tem % ratio;
100
101 if (rows_remainder != 0 || cols_remainder != 0) {
102 AERROR << "PyramidMapMatrix: [init] "
103 << "Rows and cols in each level should be divisible by ratio.";
104 return;
105 }
106
107 rows_tem /= ratio;
108 cols_tem /= ratio;
109 }
110
111 resolution_num_ = resolution_num;
112 ratio_ = ratio;
113
114 has_intensity_ = has_intensity;
115 has_intensity_var_ = has_intensity_var;
116 has_altitude_ = has_altitude;
117 has_altitude_var_ = has_altitude_var;
118 has_ground_altitude_ = has_ground_altitude;
119 has_count_ = has_count;
120 has_ground_count_ = has_ground_count;
121
122 // Init rows_mr_ and cols_mr_
123 rows_mr_.resize(resolution_num_, 0);
124 cols_mr_.resize(resolution_num_, 0);
125 rows_mr_[0] = rows;
126 cols_mr_[0] = cols;
127 for (unsigned int i = 1; i < resolution_num_; ++i) {
128 rows_mr_[i] = rows_mr_[i - 1] / ratio_;
129 cols_mr_[i] = cols_mr_[i - 1] / ratio_;
130 }
131
132 // Init data matrixes
133 if (has_intensity_) {
134 intensity_matrixes_.resize(resolution_num_);
135 for (unsigned int i = 0; i < resolution_num_; i++) {
136 intensity_matrixes_[i].Init(rows_mr_[i], cols_mr_[i]);
137 }
138 }
139 if (has_intensity_var_) {
140 intensity_var_matrixes_.resize(resolution_num_);
141 for (unsigned int i = 0; i < resolution_num_; i++) {
142 intensity_var_matrixes_[i].Init(rows_mr_[i], cols_mr_[i]);
143 }
144 }
145 if (has_altitude_) {
146 altitude_matrixes_.resize(resolution_num_);
147 for (unsigned int i = 0; i < resolution_num_; i++) {
148 altitude_matrixes_[i].Init(rows_mr_[i], cols_mr_[i]);
149 }
150 }
151 if (has_altitude_var_) {
152 altitude_var_matrixes_.resize(resolution_num_);
153 for (unsigned int i = 0; i < resolution_num_; i++) {
154 altitude_var_matrixes_[i].Init(rows_mr_[i], cols_mr_[i]);
155 }
156 }
157 if (has_ground_altitude_) {
158 ground_altitude_matrixes_.resize(resolution_num_);
159 for (unsigned int i = 0; i < resolution_num_; i++) {
160 ground_altitude_matrixes_[i].Init(rows_mr_[i], cols_mr_[i]);
161 }
162 }
163 if (has_count_) {
164 count_matrixes_.resize(resolution_num_);
165 for (unsigned int i = 0; i < resolution_num_; i++) {
166 count_matrixes_[i].Init(rows_mr_[i], cols_mr_[i]);
167 }
168 }
169 if (has_ground_count_) {
170 ground_count_matrixes_.resize(resolution_num_);
171 for (unsigned int i = 0; i < resolution_num_; i++) {
172 ground_count_matrixes_[i].Init(rows_mr_[i], cols_mr_[i]);
173 }
174 }
175
176 // Init ratio multiplier
177 unsigned int size = std::max(rows_mr_[0], cols_mr_[0]);
178 ratio_multiplier_.resize(size, 0);
179 for (unsigned int i = 0; i < size; ++i) {
180 ratio_multiplier_[i] = i * ratio_;
181 }
182}

◆ MergeCellBase()

void apollo::localization::msf::pyramid_map::PyramidMapMatrix::MergeCellBase ( const float *  intensity,
const float *  intensity_var,
const float *  altitude,
const unsigned int *  count,
unsigned int  row,
unsigned int  col,
unsigned int  level 
)
inline

Merge the data from another map cell.

only merge count, intensity, intensity var and altitude

在文件 pyramid_map_matrix.h427 行定义.

432 {
433 unsigned int new_count = count_matrixes_[level][row][col] + *count;
434 float p0 = static_cast<float>(count_matrixes_[level][row][col]) /
435 static_cast<float>(new_count);
436 float p1 = static_cast<float>(*count) / static_cast<float>(new_count);
437
438 float intensity_diff = 0.0f;
439 intensity_diff = intensity_matrixes_[level][row][col] - *intensity;
440 intensity_matrixes_[level][row][col] =
441 intensity_matrixes_[level][row][col] * p0 + *intensity * p1;
442
443 intensity_var_matrixes_[level][row][col] =
444 intensity_var_matrixes_[level][row][col] * p0 + *intensity_var * p1 +
445 intensity_diff * intensity_diff * p0 * p1;
446
447 altitude_matrixes_[level][row][col] =
448 altitude_matrixes_[level][row][col] * p0 + *altitude * p1;
449
450 count_matrixes_[level][row][col] = new_count;
451}

◆ MergeCellSafe()

void apollo::localization::msf::pyramid_map::PyramidMapMatrix::MergeCellSafe ( const float *  intensity,
const float *  intensity_var,
const float *  altitude,
const float *  altitude_var,
const float *  ground_altitude,
const unsigned int *  count,
const unsigned int *  ground_count,
unsigned int  row,
unsigned int  col,
unsigned int  level 
)

Merge the data from another map cell by check.

在文件 pyramid_map_matrix.cc1238 行定义.

1242 {
1243 if (!CheckLegalityForGetData(row, col, level)) {
1244 AERROR << "PyramidMapMatrix: [MergeCellSafe] Params is illegal.";
1245 return;
1246 }
1247
1248 if (count == nullptr || !has_count_) {
1249 return;
1250 }
1251
1252 unsigned int new_count = count_matrixes_[level][row][col] + *count;
1253 float p0 = static_cast<float>(count_matrixes_[level][row][col]) /
1254 static_cast<float>(new_count);
1255 float p1 = static_cast<float>(*count) / static_cast<float>(new_count);
1256
1257 float intensity_diff = 0.0f;
1258 if (intensity != nullptr && has_intensity_) {
1259 intensity_diff = intensity_matrixes_[level][row][col] - *intensity;
1260 intensity_matrixes_[level][row][col] =
1261 intensity_matrixes_[level][row][col] * p0 + *intensity * p1;
1262 }
1263
1264 if (intensity != nullptr && has_intensity_ && intensity_var != nullptr &&
1265 has_intensity_var_) {
1266 intensity_var_matrixes_[level][row][col] =
1267 intensity_var_matrixes_[level][row][col] * p0 + *intensity_var * p1 +
1268 intensity_diff * intensity_diff * p0 * p1;
1269 }
1270
1271 float altitude_diff = 0.0f;
1272 if (altitude != nullptr && has_altitude_) {
1273 altitude_diff = altitude_matrixes_[level][row][col] - *altitude;
1274 altitude_matrixes_[level][row][col] =
1275 altitude_matrixes_[level][row][col] * p0 + *altitude * p1;
1276 }
1277
1278 if (altitude != nullptr && has_altitude_ && altitude_var != nullptr &&
1279 has_altitude_var_) {
1280 altitude_var_matrixes_[level][row][col] =
1281 altitude_var_matrixes_[level][row][col] * p0 + *altitude_var * p1 +
1282 altitude_diff * altitude_diff * p0 * p1;
1283 }
1284
1285 count_matrixes_[level][row][col] = new_count;
1286
1287 // for points on ground
1288 if (ground_count == nullptr || !has_ground_count_) {
1289 return;
1290 }
1291
1292 unsigned int new_ground_count =
1293 ground_count_matrixes_[level][row][col] + *ground_count;
1294 p0 = static_cast<float>(ground_count_matrixes_[level][row][col]) /
1295 static_cast<float>(new_ground_count);
1296 p1 = static_cast<float>(*ground_count) / static_cast<float>(new_ground_count);
1297
1298 if (ground_altitude != nullptr && has_ground_altitude_) {
1299 ground_altitude_matrixes_[level][row][col] =
1300 ground_altitude_matrixes_[level][row][col] * p0 + *ground_altitude * p1;
1301 }
1302
1303 ground_count_matrixes_[level][row][col] = new_ground_count;
1304}

◆ operator=()

PyramidMapMatrix & apollo::localization::msf::pyramid_map::PyramidMapMatrix::operator= ( const PyramidMapMatrix map_matrix)

在文件 pyramid_map_matrix.cc432 行定义.

433 {
434 Clear();
435 resolution_num_ = map_matrix.resolution_num_;
436 ratio_ = map_matrix.ratio_;
437 rows_mr_ = map_matrix.rows_mr_;
438 cols_mr_ = map_matrix.cols_mr_;
439 ratio_multiplier_ = map_matrix.ratio_multiplier_;
440
441 intensity_matrixes_ = map_matrix.intensity_matrixes_;
442 intensity_var_matrixes_ = map_matrix.intensity_var_matrixes_;
443 altitude_matrixes_ = map_matrix.altitude_matrixes_;
444 altitude_var_matrixes_ = map_matrix.altitude_var_matrixes_;
445 ground_altitude_matrixes_ = map_matrix.ground_altitude_matrixes_;
446 count_matrixes_ = map_matrix.count_matrixes_;
447 ground_count_matrixes_ = map_matrix.ground_count_matrixes_;
448
449 has_intensity_ = map_matrix.has_intensity_;
450 has_intensity_var_ = map_matrix.has_intensity_var_;
451 has_altitude_ = map_matrix.has_altitude_;
452 has_altitude_var_ = map_matrix.has_altitude_var_;
453 has_ground_altitude_ = map_matrix.has_ground_altitude_;
454 has_count_ = map_matrix.has_count_;
455 has_ground_count_ = map_matrix.has_ground_count_;
456 return *this;
457}

◆ Reduce()

void apollo::localization::msf::pyramid_map::PyramidMapMatrix::Reduce ( std::shared_ptr< PyramidMapMatrix cells,
const PyramidMapMatrix new_cells,
unsigned int  level = 0,
unsigned int  new_level = 0 
)
static

Combine two PyramidMapMatrix instances (Reduce).

在文件 pyramid_map_matrix.cc1484 行定义.

1486 {
1487 if (level >= cells->resolution_num_) {
1488 AERROR << "PyramidMapMatrix: [Reduce] The level id is illegal.";
1489 return;
1490 }
1491
1492 if (new_level >= new_cells.resolution_num_) {
1493 AERROR << "PyramidMapMatrix: [Reduce] The new level id is illegal.";
1494 return;
1495 }
1496
1497 if (cells->rows_mr_[level] != new_cells.rows_mr_[new_level] ||
1498 cells->cols_mr_[level] != new_cells.cols_mr_[new_level]) {
1499 return;
1500 }
1501
1502 for (unsigned int r = 0; r < cells->rows_mr_[level]; r++) {
1503 for (unsigned int c = 0; c < cells->cols_mr_[level]; c++) {
1504 const float* intensity = new_cells.GetIntensitySafe(r, c, new_level);
1505 const float* intensity_var =
1506 new_cells.GetIntensityVarSafe(r, c, new_level);
1507 const float* altitude = new_cells.GetAltitudeSafe(r, c, new_level);
1508 const float* altitude_var = new_cells.GetAltitudeVarSafe(r, c, new_level);
1509 const float* ground_altitude =
1510 new_cells.GetGroundAltitudeSafe(r, c, new_level);
1511 const unsigned int* count = new_cells.GetCountSafe(r, c, new_level);
1512 const unsigned int* ground_count =
1513 new_cells.GetGroundCountSafe(r, c, new_level);
1514
1515 cells->MergeCellSafe(intensity, intensity_var, altitude, altitude_var,
1516 ground_altitude, count, ground_count, r, c, level);
1517 }
1518 }
1519}

◆ Reset() [1/2]

void apollo::localization::msf::pyramid_map::PyramidMapMatrix::Reset ( )
virtual

Reset map cells data.

实现了 apollo::localization::msf::pyramid_map::BaseMapMatrix.

在文件 pyramid_map_matrix.cc67 行定义.

67 {
68 for (unsigned int i = 0; i < resolution_num_; i++) {
69 Reset(i);
70 }
71}

◆ Reset() [2/2]

void apollo::localization::msf::pyramid_map::PyramidMapMatrix::Reset ( unsigned int  level)

Reset all of map cells data in a specific resolution level.

在文件 pyramid_map_matrix.cc184 行定义.

184 {
185 if (level >= resolution_num_) {
186 AERROR << "PyramidMapMatrix: [reset] The level id is illegal.";
187 return;
188 }
189
190 if (has_intensity_) {
191 intensity_matrixes_[level].MakeEmpty();
192 }
193 if (has_intensity_var_) {
194 intensity_var_matrixes_[level].MakeEmpty();
195 }
196 if (has_altitude_) {
197 altitude_matrixes_[level].MakeEmpty();
198 }
199 if (has_altitude_var_) {
200 altitude_var_matrixes_[level].MakeEmpty();
201 }
202 if (has_ground_altitude_) {
203 ground_altitude_matrixes_[level].MakeEmpty();
204 }
205 if (has_count_) {
206 count_matrixes_[level].MakeEmpty();
207 }
208 if (has_ground_count_) {
209 ground_count_matrixes_[level].MakeEmpty();
210 }
211}

◆ ResetCell()

void apollo::localization::msf::pyramid_map::PyramidMapMatrix::ResetCell ( unsigned int  id,
unsigned int  level = 0 
)

Reset a map cell in a specific resolution level.

在文件 pyramid_map_matrix.cc250 行定义.

250 {
251 ResetCells(id, id, level);
252}
void ResetCells(unsigned int start_id, unsigned int end_id, unsigned int level=0)
Reset map cells data from start_id to end_id in a specific resolution level

◆ ResetCells()

void apollo::localization::msf::pyramid_map::PyramidMapMatrix::ResetCells ( unsigned int  start_id,
unsigned int  end_id,
unsigned int  level = 0 
)

Reset map cells data from start_id to end_id in a specific resolution level

在文件 pyramid_map_matrix.cc213 行定义.

214 {
215 if (level >= resolution_num_) {
216 AERROR << "PyramidMapMatrix: [ResetCells] The level id is illegal.";
217 return;
218 }
219
220 unsigned int length = rows_mr_[level] * cols_mr_[level];
221 if (start_id >= length || end_id >= length) {
222 AERROR
223 << "PyramidMapMatrix: [ResetCell] The start_id or end_id is illegal.";
224 return;
225 }
226
227 if (has_intensity_) {
228 intensity_matrixes_[level].MakeEmpty(start_id, end_id);
229 }
230 if (has_intensity_var_) {
231 intensity_var_matrixes_[level].MakeEmpty(start_id, end_id);
232 }
233 if (has_altitude_) {
234 altitude_matrixes_[level].MakeEmpty(start_id, end_id);
235 }
236 if (has_altitude_var_) {
237 altitude_var_matrixes_[level].MakeEmpty(start_id, end_id);
238 }
239 if (has_ground_altitude_) {
240 ground_altitude_matrixes_[level].MakeEmpty(start_id, end_id);
241 }
242 if (has_count_) {
243 count_matrixes_[level].MakeEmpty(start_id, end_id);
244 }
245 if (has_ground_count_) {
246 ground_count_matrixes_[level].MakeEmpty(start_id, end_id);
247 }
248}

◆ SetAltitudeMatrix()

void apollo::localization::msf::pyramid_map::PyramidMapMatrix::SetAltitudeMatrix ( const float *  input,
unsigned int  size,
unsigned int  start_index,
unsigned int  level = 0 
)

在文件 pyramid_map_matrix.cc869 行定义.

871 {
872 if (!has_altitude_) {
873 AERROR << "PyramidMapMatrix: [SetAltitudeMatrix] Has no altitude.";
874 return;
875 }
876
877 if (!CheckLegalityForSetData(level, start_index, size)) {
878 AERROR << "PyramidMapMatrix: [SetAltitudeMatrix] Params is illegal.";
879 return;
880 }
881
882 altitude_matrixes_[level].SetData(input, size, start_index);
883}

◆ SetAltitudeSafe()

void apollo::localization::msf::pyramid_map::PyramidMapMatrix::SetAltitudeSafe ( float  altitude,
unsigned int  row,
unsigned int  col,
unsigned int  level = 0 
)

Set an altitude value by check.

在文件 pyramid_map_matrix.cc1137 行定义.

1138 {
1139 if (!has_altitude_) {
1140 AERROR << "PyramidMapMatrix: [SetAltitudeSafe] Has no altitude.";
1141 return;
1142 }
1143
1144 if (!CheckLegalityForGetData(row, col, level)) {
1145 AERROR << "PyramidMapMatrix: [SetAltitudeSafe] Params is illegal.";
1146 return;
1147 }
1148
1149 altitude_matrixes_[level][row][col] = altitude;
1150}

◆ SetAltitudeVarMatrix()

void apollo::localization::msf::pyramid_map::PyramidMapMatrix::SetAltitudeVarMatrix ( const float *  input,
unsigned int  size,
unsigned int  start_index,
unsigned int  level = 0 
)

在文件 pyramid_map_matrix.cc885 行定义.

888 {
889 if (!has_altitude_var_) {
890 AERROR << "PyramidMapMatrix: [SetAltitudeVarMatrix] Has no altitude_var.";
891 return;
892 }
893
894 if (!CheckLegalityForSetData(level, start_index, size)) {
895 AERROR << "PyramidMapMatrix: [SetAltitudeVarMatrix] Params is illegal.";
896 return;
897 }
898
899 altitude_var_matrixes_[level].SetData(input, size, start_index);
900}

◆ SetAltitudeVarSafe()

void apollo::localization::msf::pyramid_map::PyramidMapMatrix::SetAltitudeVarSafe ( float  altitude_var,
unsigned int  row,
unsigned int  col,
unsigned int  level = 0 
)

Set an altitude variance value by check.

在文件 pyramid_map_matrix.cc1152 行定义.

1154 {
1155 if (!has_altitude_var_) {
1156 AERROR << "PyramidMapMatrix: [SetAltitudeVarSafe] Has no altitude var.";
1157 return;
1158 }
1159
1160 if (!CheckLegalityForGetData(row, col, level)) {
1161 AERROR << "PyramidMapMatrix: [SetAltitudeVarSafe] Params is illegal.";
1162 return;
1163 }
1164
1165 altitude_var_matrixes_[level][row][col] = altitude_var;
1166}

◆ SetCountMatrix()

void apollo::localization::msf::pyramid_map::PyramidMapMatrix::SetCountMatrix ( const unsigned int *  input,
unsigned int  size,
unsigned int  start_index,
unsigned int  level = 0 
)

在文件 pyramid_map_matrix.cc920 行定义.

923 {
924 if (!has_count_) {
925 AERROR << "PyramidMapMatrix: [SetCountMatrix] Has no count.";
926 return;
927 }
928
929 if (!CheckLegalityForSetData(level, start_index, size)) {
930 AERROR << "PyramidMapMatrix: [SetCountMatrix] Params is illegal.";
931 return;
932 }
933
934 count_matrixes_[level].SetData(input, size, start_index);
935}

◆ SetCountSafe()

void apollo::localization::msf::pyramid_map::PyramidMapMatrix::SetCountSafe ( unsigned int  count,
unsigned int  row,
unsigned int  col,
unsigned int  level = 0 
)

Set a count value by check.

在文件 pyramid_map_matrix.cc1185 行定义.

1186 {
1187 if (!has_count_) {
1188 AERROR << "PyramidMapMatrix: [SetCountSafe] Has no count.";
1189 return;
1190 }
1191
1192 if (!CheckLegalityForGetData(row, col, level)) {
1193 AERROR << "PyramidMapMatrix: [SetCountSafe] Params is illegal.";
1194 return;
1195 }
1196
1197 count_matrixes_[level][row][col] = count;
1198}

◆ SetFloatMatrixRoi()

void apollo::localization::msf::pyramid_map::PyramidMapMatrix::SetFloatMatrixRoi ( const FloatMatrix source_matrix,
const Rect2D< unsigned int > &  source_roi,
const Rect2D< unsigned int > &  target_roi,
unsigned int  type,
unsigned int  level = 0 
)

set float matrix with a ROI.

type: intensity 0; intensity_var 1; altitude 2; altitude_var 3; ground_altitude 4;

在文件 pyramid_map_matrix.cc954 行定义.

958 {
959 if (source_matrix == nullptr) {
960 AERROR << "PyramidMapMatrix: [SetFloatMatrixRoi] Source matrix is nullptr.";
961 return;
962 }
963
964 switch (type) {
965 case 0:
966 if (!has_intensity_) {
967 AERROR << "PyramidMapMatrix: [SetFloatMatrixRoi] Has no intensity.";
968 return;
969 }
970 break;
971 case 1:
972 if (!has_intensity_var_) {
973 AERROR << "PyramidMapMatrix: [SetFloatMatrixRoi] Has no intensity var.";
974 return;
975 }
976 break;
977 case 2:
978 if (!has_altitude_) {
979 AERROR << "PyramidMapMatrix: [SetFloatMatrixRoi] Has no altitude.";
980 return;
981 }
982 break;
983 case 3:
984 if (!has_altitude_var_) {
985 AERROR << "PyramidMapMatrix: [SetFloatMatrixRoi] Has no altitude var.";
986 return;
987 }
988 break;
989 case 4:
990 if (!has_ground_altitude_) {
991 AERROR
992 << "PyramidMapMatrix: [SetFloatMatrixRoi] Has no ground altitude.";
993 return;
994 }
995 break;
996 }
997
998 if (!CheckLegalityForSetDataRoi(
999 level, static_cast<unsigned int>(source_matrix->GetRow()),
1000 static_cast<unsigned int>(source_matrix->GetCol()), source_roi,
1001 target_roi)) {
1002 AERROR << "PyramidMapMatrix: [SetFloatMatrixRoi] Params is illegal.";
1003 return;
1004 }
1005
1006 const unsigned int& source_roi_min_x = source_roi.GetMinX();
1007 const unsigned int& source_roi_min_y = source_roi.GetMinY();
1008
1009 const unsigned int& target_roi_min_x = target_roi.GetMinX();
1010 const unsigned int& target_roi_min_y = target_roi.GetMinY();
1011 const unsigned int& target_roi_max_x = target_roi.GetMaxX();
1012 const unsigned int& target_roi_max_y = target_roi.GetMaxY();
1013
1014 // unsigned int roi_rows = target_roi_max_y - target_roi_min_y + 1;
1015 unsigned int roi_cols = target_roi_max_x - target_roi_min_x + 1;
1016
1017 unsigned int inc = 0;
1018 for (unsigned int y = target_roi_min_y; y <= target_roi_max_y; ++y) {
1019 unsigned int target_start_index = y * cols_mr_[level] + target_roi_min_x;
1020 unsigned int source_start_index =
1021 (source_roi_min_y + inc) * source_matrix->GetCol() + source_roi_min_x;
1022 const float* input = (*source_matrix)[0] + source_start_index;
1023
1024 switch (type) {
1025 case 0:
1026 SetIntensityMatrix(input, roi_cols, target_start_index, level);
1027 break;
1028 case 1:
1029 SetIntensityVarMatrix(input, roi_cols, target_start_index, level);
1030 break;
1031 case 2:
1032 SetAltitudeMatrix(input, roi_cols, target_start_index, level);
1033 break;
1034 case 3:
1035 SetAltitudeVarMatrix(input, roi_cols, target_start_index, level);
1036 break;
1037 case 4:
1038 SetGroundAltitudeMatrix(input, roi_cols, target_start_index, level);
1039 break;
1040 }
1041 ++inc;
1042 }
1043}
void SetAltitudeVarMatrix(const float *input, unsigned int size, unsigned int start_index, unsigned int level=0)
void SetIntensityMatrix(const float *input, unsigned int size, unsigned int start_index, unsigned int level=0)
void SetAltitudeMatrix(const float *input, unsigned int size, unsigned int start_index, unsigned int level=0)
void SetIntensityVarMatrix(const float *input, unsigned int size, unsigned int start_index, unsigned int level=0)
void SetGroundAltitudeMatrix(const float *input, unsigned int size, unsigned int start_index, unsigned int level=0)

◆ SetGroundAltitudeMatrix()

void apollo::localization::msf::pyramid_map::PyramidMapMatrix::SetGroundAltitudeMatrix ( const float *  input,
unsigned int  size,
unsigned int  start_index,
unsigned int  level = 0 
)

在文件 pyramid_map_matrix.cc902 行定义.

905 {
906 if (!has_ground_altitude_) {
907 AERROR << "PyramidMapMatrix: [SetGroundAltitudeMatrix] Has no "
908 "ground_altitude.";
909 return;
910 }
911
912 if (!CheckLegalityForSetData(level, start_index, size)) {
913 AERROR << "PyramidMapMatrix: [SetGroundAltitudeMatrix] Params is illegal.";
914 return;
915 }
916
917 ground_altitude_matrixes_[level].SetData(input, size, start_index);
918}

◆ SetGroundAltitudeSafe()

void apollo::localization::msf::pyramid_map::PyramidMapMatrix::SetGroundAltitudeSafe ( float  ground_altitude,
unsigned int  row,
unsigned int  col,
unsigned int  level = 0 
)

Set an altitude ground value by check.

在文件 pyramid_map_matrix.cc1168 行定义.

1170 {
1171 if (!has_ground_altitude_) {
1172 AERROR
1173 << "PyramidMapMatrix: [SetGroundAltitudeSafe] Has no ground altitude.";
1174 return;
1175 }
1176
1177 if (!CheckLegalityForGetData(row, col, level)) {
1178 AERROR << "PyramidMapMatrix: [SetGroundAltitudeSafe] Params is illegal.";
1179 return;
1180 }
1181
1182 ground_altitude_matrixes_[level][row][col] = ground_altitude;
1183}

◆ SetGroundCountMatrix()

void apollo::localization::msf::pyramid_map::PyramidMapMatrix::SetGroundCountMatrix ( const unsigned int *  input,
unsigned int  size,
unsigned int  start_index,
unsigned int  level = 0 
)

在文件 pyramid_map_matrix.cc937 行定义.

940 {
941 if (!has_ground_count_) {
942 AERROR << "PyramidMapMatrix: [SetGroundCountMatrix] Has no ground count.";
943 return;
944 }
945
946 if (!CheckLegalityForSetData(level, start_index, size)) {
947 AERROR << "PyramidMapMatrix: [SetGroundCountMatrix] Params is illegal.";
948 return;
949 }
950
951 ground_count_matrixes_[level].SetData(input, size, start_index);
952}

◆ SetGroundCountSafe()

void apollo::localization::msf::pyramid_map::PyramidMapMatrix::SetGroundCountSafe ( unsigned int  ground_count,
unsigned int  row,
unsigned int  col,
unsigned int  level = 0 
)

Set a ground count value by check.

在文件 pyramid_map_matrix.cc1200 行定义.

1202 {
1203 if (!has_ground_count_) {
1204 AERROR << "PyramidMapMatrix: [SetGroundCountSafe] Has no ground count.";
1205 return;
1206 }
1207
1208 if (!CheckLegalityForGetData(row, col, level)) {
1209 AERROR << "PyramidMapMatrix: [SetGroundCountSafe] Params is illegal.";
1210 return;
1211 }
1212
1213 ground_count_matrixes_[level][row][col] = ground_count;
1214}

◆ SetIntensityMatrix()

void apollo::localization::msf::pyramid_map::PyramidMapMatrix::SetIntensityMatrix ( const float *  input,
unsigned int  size,
unsigned int  start_index,
unsigned int  level = 0 
)

在文件 pyramid_map_matrix.cc835 行定义.

837 {
838 if (!has_intensity_) {
839 AERROR << "PyramidMapMatrix: [SetIntensityMatrix] Has no intensity.";
840 return;
841 }
842
843 if (!CheckLegalityForSetData(level, start_index, size)) {
844 AERROR << "PyramidMapMatrix: [SetIntensityMatrix] Params is illegal.";
845 return;
846 }
847
848 intensity_matrixes_[level].SetData(input, size, start_index);
849}

◆ SetIntensitySafe()

void apollo::localization::msf::pyramid_map::PyramidMapMatrix::SetIntensitySafe ( float  intensity,
unsigned int  row,
unsigned int  col,
unsigned int  level = 0 
)

Set an intensity value by check.

在文件 pyramid_map_matrix.cc1106 行定义.

1107 {
1108 if (!has_intensity_) {
1109 AERROR << "PyramidMapMatrix: [SetIntensitySafe] Has no intensity.";
1110 return;
1111 }
1112
1113 if (!CheckLegalityForGetData(row, col, level)) {
1114 AERROR << "PyramidMapMatrix: [SetIntensitySafe] Params is illegal.";
1115 return;
1116 }
1117
1118 intensity_matrixes_[level][row][col] = intensity;
1119}

◆ SetIntensityVarMatrix()

void apollo::localization::msf::pyramid_map::PyramidMapMatrix::SetIntensityVarMatrix ( const float *  input,
unsigned int  size,
unsigned int  start_index,
unsigned int  level = 0 
)

在文件 pyramid_map_matrix.cc851 行定义.

854 {
855 if (!has_intensity_var_) {
856 AERROR
857 << "PyramidMapMatrix: [set_intensity_var_matrix] Has no intensity_var.";
858 return;
859 }
860
861 if (!CheckLegalityForSetData(level, start_index, size)) {
862 AERROR << "PyramidMapMatrix: [set_intensity_var_matrix] Params is illegal.";
863 return;
864 }
865
866 intensity_var_matrixes_[level].SetData(input, size, start_index);
867}

◆ SetIntensityVarSafe()

void apollo::localization::msf::pyramid_map::PyramidMapMatrix::SetIntensityVarSafe ( float  intensity_var,
unsigned int  row,
unsigned int  col,
unsigned int  level = 0 
)

Set an intensity variance value by check.

在文件 pyramid_map_matrix.cc1121 行定义.

1123 {
1124 if (!has_intensity_var_) {
1125 AERROR << "PyramidMapMatrix: [SetIntensityVarSafe] Has no intensity_var.";
1126 return;
1127 }
1128
1129 if (!CheckLegalityForGetData(row, col, level)) {
1130 AERROR << "PyramidMapMatrix: [SetIntensityVarSafe] Params is illegal.";
1131 return;
1132 }
1133
1134 intensity_var_matrixes_[level][row][col] = intensity_var;
1135}

◆ SetUintMatrixRoi()

void apollo::localization::msf::pyramid_map::PyramidMapMatrix::SetUintMatrixRoi ( const UIntMatrix source_matrix,
const Rect2D< unsigned int > &  source_roi,
const Rect2D< unsigned int > &  target_roi,
unsigned int  type,
unsigned int  level = 0 
)

set unsigned int matrix with a ROI.

type: count 0; ground cout 1;

在文件 pyramid_map_matrix.cc1045 行定义.

1048 {
1049 if (source_matrix == nullptr) {
1050 AERROR << "PyramidMapMatrix: [SetUintMatrixRoi] Source matrix is nullptr.";
1051 return;
1052 }
1053
1054 switch (type) {
1055 case 0:
1056 if (!has_count_) {
1057 AERROR << "PyramidMapMatrix: [SetUintMatrixRoi] Has no count.";
1058 return;
1059 }
1060 break;
1061 case 1:
1062 if (!has_ground_count_) {
1063 AERROR << "PyramidMapMatrix: [SetUintMatrixRoi] Has no ground count.";
1064 return;
1065 }
1066 break;
1067 }
1068
1069 if (!CheckLegalityForSetDataRoi(
1070 level, static_cast<unsigned int>(source_matrix->GetRow()),
1071 static_cast<unsigned int>(source_matrix->GetCol()), source_roi,
1072 target_roi)) {
1073 AERROR << "PyramidMapMatrix: [SetUintMatrixRoi] Params is illegal.";
1074 return;
1075 }
1076
1077 const unsigned int& source_roi_min_x = source_roi.GetMinX();
1078 const unsigned int& source_roi_min_y = source_roi.GetMinY();
1079
1080 const unsigned int& target_roi_min_x = target_roi.GetMinX();
1081 const unsigned int& target_roi_min_y = target_roi.GetMinY();
1082 const unsigned int& target_roi_max_x = target_roi.GetMaxX();
1083 const unsigned int& target_roi_max_y = target_roi.GetMaxY();
1084
1085 unsigned int roi_cols = target_roi_max_x - target_roi_min_x + 1;
1086
1087 unsigned int inc = 0;
1088 for (unsigned int y = target_roi_min_y; y <= target_roi_max_y; ++y) {
1089 unsigned int target_start_index = y * cols_mr_[level] + target_roi_min_x;
1090 unsigned int source_start_index =
1091 (source_roi_min_y + inc) * source_matrix->GetCol() + source_roi_min_x;
1092 const unsigned int* input = (*source_matrix)[0] + source_start_index;
1093
1094 switch (type) {
1095 case 0:
1096 SetCountMatrix(input, roi_cols, target_start_index, level);
1097 break;
1098 case 1:
1099 SetGroundCountMatrix(input, roi_cols, target_start_index, level);
1100 break;
1101 }
1102 ++inc;
1103 }
1104}
void SetGroundCountMatrix(const unsigned int *input, unsigned int size, unsigned int start_index, unsigned int level=0)
void SetCountMatrix(const unsigned int *input, unsigned int size, unsigned int start_index, unsigned int level=0)

◆ SetValueSafe()

void apollo::localization::msf::pyramid_map::PyramidMapMatrix::SetValueSafe ( unsigned char  intensity,
float  altitude,
unsigned int  row,
unsigned int  col,
unsigned int  level = 0 
)

Set the several values by check.

参数
<altitude>The altitude of the cell.
<intensity>The reflectance intensity.

在文件 pyramid_map_matrix.cc1216 行定义.

1218 {
1219 if (!has_intensity_) {
1220 AERROR << "PyramidMapMatrix: [SetValueSafe] Has no intensity.";
1221 return;
1222 }
1223
1224 if (!has_altitude_) {
1225 AERROR << "PyramidMapMatrix: [SetValueSafe] Has no altitude.";
1226 return;
1227 }
1228
1229 if (!CheckLegalityForGetData(row, col, level)) {
1230 AERROR << "PyramidMapMatrix: [SetValueSafe] Params is illegal.";
1231 return;
1232 }
1233
1234 intensity_matrixes_[level][row][col] = intensity;
1235 altitude_matrixes_[level][row][col] = altitude;
1236}

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