25 namespace perception {
30 const std::vector<float> &k_mat,
31 const std::vector<float> &ground3,
32 std::vector<float> *ground4);
35 const std::vector<float> &k_mat,
36 const std::vector<float> &ground4,
37 std::vector<float> *ground3);
40 const std::vector<float> &k_mat,
41 const std::vector<float> &ground3,
float *pitch,
45 const float &baseline,
const float &pitch,
46 const float &cam_height,
47 std::vector<float> *ground3);
57 void Push(
const std::vector<float> &ph,
const float &inlier_ratio);
59 void GetGround(
float *pitch,
float *cam_height);
64 int length =
static_cast<int>(pitch_height_inlier_tracks_.size());
71 std::vector<float> pitch_height_inlier_tracks_;
72 std::vector<float> const_weight_temporal_;
73 std::vector<float> weight_;
106 delete ground_plane_tracker_;
107 ground_plane_tracker_ =
nullptr;
110 void Init(
const std::vector<float> &k_mat,
int width,
int height,
111 float baseline,
int max_nr_samples = 1080) {
112 CHECK_EQ(k_mat.size(), 9U);
113 memcpy(k_mat_, k_mat.data(),
sizeof(float) * 9);
116 baseline_ = baseline;
117 ss_flt_.resize(max_nr_samples * 2);
118 ss_int_.resize(max_nr_samples * 2);
126 bool DetetGround(
float pitch,
float camera_height,
128 int count_vd,
const std::vector<float> &plane = {});
134 return ground_is_valid_;
138 void FillGroundModel(
const std::vector<float> &ground3) {
139 CHECK_EQ(ground3.size(), 3U);
145 bool DetectGroundFromSamples(
float *vd,
int count_vd,
float *inlier_ratio);
151 float k_mat_[9] = {0};
152 float baseline_ = 0.0f;
156 std::vector<int> ss_int_ = {};
157 std::vector<float> ss_flt_ = {};
159 bool ground_is_valid_ =
false;
167 template <
typename T>
170 T x[2] = {v[0], d[0]};
171 T xp[2] = {v[1], d[1]};
178 template <
typename T>
184 *cost =
static_cast<T
>(0.0f);
188 for (
int i = 0; i < n; ++i) {
189 T d_proj = refx[0] * p[0] + p[1];
190 T proj_err =
static_cast<T
>(fabs(d_proj - refp[0]));
191 if (proj_err < error_tol) {
192 inliers[(*nr_inlier)++] = i;
GroundPlaneTracker(int track_length)
float thres_inlier_plane_fitting
Definition: camera_ground_plane.h:86
bool GetGroundModel(float *l) const
Definition: camera_ground_plane.h:130
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
float IRec(float a)
Definition: i_basic.h:69
void GroundHypoGenFunc(const T *v, const T *d, T *p)
Definition: camera_ground_plane.h:168
float max_camera_ground_height
Definition: camera_ground_plane.h:84
bool ConvertGround4ToGround3(const float &baseline, const std::vector< float > &k_mat, const std::vector< float > &ground4, std::vector< float > *ground3)
int nr_frames_track
Definition: camera_ground_plane.h:82
float min_inlier_ratio
Definition: camera_ground_plane.h:85
CameraGroundPlaneParams()
Definition: camera_ground_plane.h:78
void GetGround(float *pitch, float *cam_height)
int GetCurTrackLength()
Definition: camera_ground_plane.h:63
Definition: camera_ground_plane.h:100
void ILineFit2d(const T *x, const T *xp, T *l)
Definition: i_line.h:68
void operator=(const CameraGroundPlaneParams ¶ms)
Definition: camera_ground_plane.h:88
float max_tilt_angle
Definition: camera_ground_plane.h:83
void ConvertGround3ToGround4(const float &baseline, const std::vector< float > &k_mat, const std::vector< float > &ground3, std::vector< float > *ground4)
void GetGround3FromPitchHeight(const std::vector< float > &k_mat, const float &baseline, const float &pitch, const float &cam_height, std::vector< float > *ground3)
~CameraGroundPlaneDetector()
Definition: camera_ground_plane.h:105
void Push(const std::vector< float > &ph, const float &inlier_ratio)
void Init(const std::vector< float > &k_mat, int width, int height, float baseline, int max_nr_samples=1080)
Definition: camera_ground_plane.h:110
void GroundFittingCostFunc(const T *p, const T *v, const T *d, int n, int *nr_inlier, int *inliers, T *cost, T error_tol)
Definition: camera_ground_plane.h:179
~GroundPlaneTracker()
Definition: camera_ground_plane.h:55
Definition: camera_ground_plane.h:77
int get_min_nr_samples()
Definition: camera_ground_plane.h:121
void GetGroundPlanePitchHeight(const float &baseline, const std::vector< float > &k_mat, const std::vector< float > &ground3, float *pitch, float *cam_height)
Definition: camera_ground_plane.h:52
int min_nr_samples
Definition: camera_ground_plane.h:81
CameraGroundPlaneDetector()
Definition: camera_ground_plane.h:102