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()) {
226
227
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);
243 ADEBUG <<
"ph: " << ph[0] <<
", " << ph[1];
246 if (success) {
247 ground_plane_tracker_->
Push(ph, inlier_ratio);
248 ground_plane_tracker_->
GetGround(&ph[0], &ph[1]);
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
264 ground_plane_tracker_->
GetGround(&ph[0], &ph[1]);
266 FillGroundModel(ground3);
267 } else {
270 CHECK_GT(camera_height, 0.f);
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)
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)
float max_camera_ground_height