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);
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);
148 CameraGroundPlaneParams params_;
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;
161 GroundPlaneTracker *ground_plane_tracker_ =
nullptr;
170 T x[2] = {v[0], d[0]};
171 T xp[2] = {v[1], d[1]};
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;
void Init(const std::vector< float > &k_mat, int width, int height, float baseline, int max_nr_samples=1080)
CameraGroundPlaneDetector()
bool DetetGround(float pitch, float camera_height, float *vd, int count_vd, const std::vector< float > &plane={})
~CameraGroundPlaneDetector()
bool GetGroundModel(float *l) const
void GetGround(float *pitch, float *cam_height)
void Push(const std::vector< float > &ph, const float &inlier_ratio)
void ILineFit2d(const T *x, const T *xp, T *l)
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 ConvertGround3ToGround4(const float &baseline, const std::vector< float > &k_mat, const std::vector< float > &ground3, std::vector< float > *ground4)
void GroundFittingCostFunc(const T *p, const T *v, const T *d, int n, int *nr_inlier, int *inliers, T *cost, T error_tol)
void GetGround3FromPitchHeight(const std::vector< float > &k_mat, const float &baseline, const float &pitch, const float &cam_height, std::vector< float > *ground3)
void GroundHypoGenFunc(const T *v, const T *d, T *p)
float max_camera_ground_height
void operator=(const CameraGroundPlaneParams ¶ms)
float thres_inlier_plane_fitting
CameraGroundPlaneParams()