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

#include <histogram_estimator.h>

apollo::perception::camera::HistogramEstimator 的协作图:

Public 成员函数

 HistogramEstimator ()
 
 ~HistogramEstimator ()
 
void Init (const HistogramEstimatorParams *params=nullptr)
 
bool Push (float val)
 
void Clear ()
 
const std::vector< uint32_t > & get_hist () const
 
float get_val_cur () const
 
float get_val_estimation () const
 
uint32_t get_bin_value (int i) const
 
bool Process ()
 

静态 Public 属性

static const int kMaxNrBins = 1000
 

详细描述

在文件 histogram_estimator.h78 行定义.

构造及析构函数说明

◆ HistogramEstimator()

apollo::perception::camera::HistogramEstimator::HistogramEstimator ( )
inline

在文件 histogram_estimator.h82 行定义.

82 {
83 hist_.resize(kMaxNrBins);
84 std::fill(hist_.begin(), hist_.end(), 0);
85
86 hist_buffer_.resize(kMaxNrBins);
87 std::fill(hist_buffer_.begin(), hist_buffer_.end(), 0);
88
89 hist_hat_.resize(kMaxNrBins);
90 std::fill(hist_hat_.begin(), hist_hat_.end(), 0.0f);
91
92 Init();
93 }
void Init(const HistogramEstimatorParams *params=nullptr)

◆ ~HistogramEstimator()

apollo::perception::camera::HistogramEstimator::~HistogramEstimator ( )
inline

在文件 histogram_estimator.h95 行定义.

95{}

成员函数说明

◆ Clear()

void apollo::perception::camera::HistogramEstimator::Clear ( )
inline

在文件 histogram_estimator.h116 行定义.

116 {
117 std::fill(hist_.begin(), hist_.end(), 0);
118 val_cur_ = val_estimation_ = 0.0f;
119 }

◆ get_bin_value()

uint32_t apollo::perception::camera::HistogramEstimator::get_bin_value ( int  i) const
inline

在文件 histogram_estimator.h127 行定义.

127 {
128 assert(i >= 0 && i < params_.nr_bins_in_histogram);
129 return hist_[i];
130 }

◆ get_hist()

const std::vector< uint32_t > & apollo::perception::camera::HistogramEstimator::get_hist ( ) const
inline

在文件 histogram_estimator.h121 行定义.

121{ return hist_; }

◆ get_val_cur()

float apollo::perception::camera::HistogramEstimator::get_val_cur ( ) const
inline

在文件 histogram_estimator.h123 行定义.

123{ return val_cur_; }

◆ get_val_estimation()

float apollo::perception::camera::HistogramEstimator::get_val_estimation ( ) const
inline

在文件 histogram_estimator.h125 行定义.

125{ return val_estimation_; }

◆ Init()

void apollo::perception::camera::HistogramEstimator::Init ( const HistogramEstimatorParams params = nullptr)

在文件 histogram_estimator.cc46 行定义.

46 {
47 if (params != nullptr) {
48 params_ = *params;
49 }
50 step_bin_reversed_ = algorithm::IRec(params_.step_bin);
51 assert(params_.nr_bins_in_histogram > 0);
52 assert(params_.nr_bins_in_histogram <= kMaxNrBins);
53 int nr_bins = params_.nr_bins_in_histogram;
54 memset(hist_.data(), 0, sizeof(uint32_t) * nr_bins);
55 GenerateHat(hist_hat_.data(), nr_bins);
56}

◆ Process()

bool apollo::perception::camera::HistogramEstimator::Process ( )

在文件 histogram_estimator.cc58 行定义.

58 {
59 // smooth histogram - >
60 // get peak & check mass ->
61 // shape anlysisi ->
62 // update estimates - >
63 // final decay
64
65 uint32_t *hist = hist_.data();
66 uint32_t *hist_smoothed = hist_buffer_.data();
67 int nr_bins = params_.nr_bins_in_histogram;
68 Smooth(hist, nr_bins, hist_smoothed);
69#if 0
70 SaveHist("input_hist", hist, nr_bins);
71 SaveHist("smoothed_hist", hist_smoothed, nr_bins);
72#endif
73 int max_index = 0;
74 uint32_t mass = 0;
75 GetPeakIndexAndMass(hist_smoothed, nr_bins, &max_index, &mass);
76 if (mass < params_.histogram_mass_limit) {
77 AERROR << "Fail: lack enough samples.";
78 return false;
79 }
80
81 if (!IsGoodShape(hist, nr_bins, max_index)) {
82 AERROR << "Fail: distribution is not good.";
83 return false;
84 }
85
86 val_estimation_ = GetValFromIndex(max_index);
87 Decay(hist, nr_bins);
88
89 return true;
90}
#define AERROR
Definition log.h:44

◆ Push()

bool apollo::perception::camera::HistogramEstimator::Push ( float  val)
inline

在文件 histogram_estimator.h99 行定义.

99 {
100 if (val < params_.data_sp || val >= params_.data_ep) {
101 AERROR << "Input data to histogram: out-of-range";
102 AERROR << params_.data_sp;
103 AERROR << params_.data_ep;
104 AERROR << val;
105 return false;
106 }
107 int index = GetIndex(val);
108 if (index < 0 || index >= params_.nr_bins_in_histogram) {
109 return false;
110 }
111 ++hist_[index];
112 val_cur_ = val;
113 return true;
114 }

类成员变量说明

◆ kMaxNrBins

const int apollo::perception::camera::HistogramEstimator::kMaxNrBins = 1000
static

在文件 histogram_estimator.h80 行定义.


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