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

#include <camera_ground_plane.h>

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

Public 成员函数

 CameraGroundPlaneDetector ()
 
 ~CameraGroundPlaneDetector ()
 
void Init (const std::vector< float > &k_mat, int width, int height, float baseline, int max_nr_samples=1080)
 
int get_min_nr_samples ()
 
bool DetetGround (float pitch, float camera_height, float *vd, int count_vd, const std::vector< float > &plane={})
 
bool GetGroundModel (float *l) const
 

详细描述

在文件 camera_ground_plane.h100 行定义.

构造及析构函数说明

◆ CameraGroundPlaneDetector()

apollo::perception::camera::CameraGroundPlaneDetector::CameraGroundPlaneDetector ( )
inline

在文件 camera_ground_plane.h102 行定义.

102 {
103 ground_plane_tracker_ = new GroundPlaneTracker(params_.nr_frames_track);
104 }

◆ ~CameraGroundPlaneDetector()

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

在文件 camera_ground_plane.h105 行定义.

105 {
106 delete ground_plane_tracker_;
107 ground_plane_tracker_ = nullptr;
108 }

成员函数说明

◆ DetetGround()

bool apollo::perception::camera::CameraGroundPlaneDetector::DetetGround ( float  pitch,
float  camera_height,
float *  vd,
int  count_vd,
const std::vector< float > &  plane = {} 
)

在文件 camera_ground_plane.cc217 行定义.

219 {
220 ground_is_valid_ = false;
221
222 std::vector<float> ground3(l_, l_ + 3);
223 std::vector<float> k_mat(k_mat_, k_mat_ + 9);
224
225 if (!plane.empty()) { // assigned from outside
226 // GetGeneralGroundPlaneModelReversed(k_mat_, baseline_, plane.data(),
227 // l_);
228 ConvertGround4ToGround3(baseline_, k_mat, plane, &ground3);
229 FillGroundModel(ground3);
230 AINFO << "set ground plane from outside: " << plane[0] << ", " << plane[1]
231 << ", " << plane[2] << ", " << plane[3];
232 ground_is_valid_ = true;
233 return true;
234 } else {
235 bool success = false;
236 float inlier_ratio = 0.0f;
237 std::vector<float> ph(2, 0);
238 if (CameraGroundPlaneDetector::DetectGroundFromSamples(vd, count_vd,
239 &inlier_ratio)) {
240 ADEBUG << "l: " << l_[0] << ", " << l_[1] << ", " << l_[2];
241 ground3.assign(l_, l_ + 3);
242 GetGroundPlanePitchHeight(baseline_, k_mat, ground3, &ph[0], &ph[1]);
243 ADEBUG << "ph: " << ph[0] << ", " << ph[1];
244 success = fabs(ph[0]) < params_.max_tilt_angle &&
245 ph[1] < params_.max_camera_ground_height;
246 if (success) {
247 ground_plane_tracker_->Push(ph, inlier_ratio);
248 ground_plane_tracker_->GetGround(&ph[0], &ph[1]);
249 GetGround3FromPitchHeight(k_mat, baseline_, ph[0], ph[1], &ground3);
250 FillGroundModel(ground3);
251 ADEBUG << "l tracked: " << l_[0] << ", " << l_[1] << ", " << l_[2];
252 ADEBUG << "ph tracked: " << ph[0] << ", " << ph[1];
253 }
254 }
255
256 if (success) {
257 ADEBUG << "succeed with inlier ratio: " << inlier_ratio;
258 ground_is_valid_ = true;
259 return true;
260 }
261
262 // backup using last successful frame or given pitch & height
263 if (ground_plane_tracker_->GetCurTrackLength() > 0) {
264 ground_plane_tracker_->GetGround(&ph[0], &ph[1]);
265 GetGround3FromPitchHeight(k_mat, baseline_, ph[0], ph[1], &ground3);
266 FillGroundModel(ground3);
267 } else {
268 ACHECK(fabs(pitch) < params_.max_tilt_angle);
269 ACHECK(camera_height < params_.max_camera_ground_height);
270 CHECK_GT(camera_height, 0.f);
271 GetGround3FromPitchHeight(k_mat, baseline_, pitch, camera_height,
272 &ground3);
273 FillGroundModel(ground3);
274 }
275 ground_plane_tracker_->Restart();
276 return false;
277 }
278}
void GetGround(float *pitch, float *cam_height)
void Push(const std::vector< float > &ph, const float &inlier_ratio)
#define ACHECK(cond)
Definition log.h:80
#define ADEBUG
Definition log.h:41
#define AINFO
Definition log.h:42
bool ConvertGround4ToGround3(const float &baseline, const std::vector< float > &k_mat, const std::vector< float > &ground4, std::vector< float > *ground3)
void GetGroundPlanePitchHeight(const float &baseline, const std::vector< float > &k_mat, const std::vector< float > &ground3, float *pitch, float *cam_height)
void GetGround3FromPitchHeight(const std::vector< float > &k_mat, const float &baseline, const float &pitch, const float &cam_height, std::vector< float > *ground3)

◆ get_min_nr_samples()

int apollo::perception::camera::CameraGroundPlaneDetector::get_min_nr_samples ( )
inline

◆ GetGroundModel()

bool apollo::perception::camera::CameraGroundPlaneDetector::GetGroundModel ( float *  l) const
inline

在文件 camera_ground_plane.h130 行定义.

130 {
131 l[0] = l_[0];
132 l[1] = l_[1];
133 l[2] = l_[2];
134 return ground_is_valid_;
135 }

◆ Init()

void apollo::perception::camera::CameraGroundPlaneDetector::Init ( const std::vector< float > &  k_mat,
int  width,
int  height,
float  baseline,
int  max_nr_samples = 1080 
)
inline

在文件 camera_ground_plane.h110 行定义.

111 {
112 CHECK_EQ(k_mat.size(), 9U);
113 memcpy(k_mat_, k_mat.data(), sizeof(float) * 9);
114 width_ = width;
115 height_ = height;
116 baseline_ = baseline;
117 ss_flt_.resize(max_nr_samples * 2);
118 ss_int_.resize(max_nr_samples * 2);
119 }
uint32_t height
Height of point cloud
uint32_t width
Width of point cloud

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