63 std::cerr <<
"Invalid ground detector parameters... " << std::endl;
70 unsigned int max_nr_samples) {
71 assert(min_nr_samples < max_nr_samples);
72 unsigned int size =
static_cast<unsigned int>(
indices.size());
73 unsigned int half = 0;
74 if (size > max_nr_samples) {
86 if (size > min_nr_samples) {
88 while (half > min_nr_samples) {
97 return static_cast<int>(
indices.size());
126 std::pair<int, int> *order) {
127 std::vector<std::pair<float, int>> map_dist;
134 for (i = 0; i < vg->
NrVoxel(); ++i) {
136 radius = voxel.dim_x_ * 0.5f;
137 cx = voxel.v_[0] + radius;
138 cy = voxel.v_[1] + radius;
139 dist2 = cx * cx + cy * cy;
140 map_dist.push_back(std::pair<float, int>(dist2, i));
142 sort(map_dist.begin(), map_dist.end(),
143 [](
const std::pair<float, int> &a,
const std::pair<float, int> &b) {
144 return a.first < b.first;
146 for (i = 0; i < map_dist.size(); ++i) {
147 id = map_dist[i].second;
149 order[i].first = voxel.iy_;
150 order[i].second = voxel.ix_;
159 unsigned int index = 0;
160 unsigned int capacity = 0;
251 memset(
reinterpret_cast<void *
>(
labels_), 0,
321 if (c > 0 && r > 0) {
328 inliers_ = IAllocAligned<int>(lap_size, 4);
330 a_array_.resize(lap_size * 2, lap_size);
333 for (
unsigned int i = 0; i < lap_size; ++i) {
353 IFree2<std::pair<float, bool>>(&
ground_z_);
366 const std::vector<int> &indices,
367 const float *z_values,
369 unsigned int nr_points,
370 unsigned int nr_point_element,
371 unsigned int nr_compares) {
375 unsigned int nr_contradi = 0;
376 unsigned int nr_z_comp_fail_threshold =
378 const float *ptr =
nullptr;
380 float delta_z = 0.0f;
381 std::vector<int>::const_iterator iter = indices.cbegin();
382 while (iter < indices.cend()) {
385 assert(pos <
static_cast<int>(nr_points));
388 ptr = point_cloud + (pos * nr_point_element);
398 if (nr_compares > nr_z_comp_fail_threshold) {
399 for (i = 0; i < nr_compares; ++i) {
400 delta_z =
IAbs(z_values[i] - z);
403 if (nr_contradi > nr_z_comp_fail_threshold) {
409 if (nr_contradi <= nr_z_comp_fail_threshold) {
425 float min_dist = 0.0f;
426 float max_dist = 0.0f;
431 dr =
static_cast<float>(r) - grid_rad;
434 dc =
static_cast<float>(c) - grid_rad;
455 k = k / (max_dist - min_dist);
458 b = (b - k * (min_dist + max_dist)) / 2;
469 const float *point_cloud,
float *height_above_ground,
470 unsigned int nr_points,
unsigned int nr_point_elements) {
473 for (r = 0; r < nr_points; ++r) {
474 height_above_ground[r] = std::numeric_limits<float>::max();
478 height_above_ground, 0, nr_points, nr_point_elements);
479 for (r = 1; r < nm1; ++r) {
482 height_above_ground, r, nr_points,
487 height_above_ground, nm1, nr_points,
494 float *height_above_ground,
unsigned int r,
unsigned int nr_points,
495 unsigned int nr_point_elements) {
501 const float *cptr =
nullptr;
502 float dist[] = {0, 0, 0, 0, 0};
503 const float *plane[] = {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr};
504 float min_abs_dist = 0.0f;
511 std::vector<int>::const_iterator iter = (*vg_coarse_)(r, 0).indices_.cbegin();
512 while (iter < (*
vg_coarse_)(r, 0).indices_.cend()) {
514 assert(pos <
static_cast<int>(nr_points));
516 cptr = point_cloud + (nr_point_elements * pos);
517 dist[0] = plane[0] !=
nullptr
519 : std::numeric_limits<float>::max();
520 min_abs_dist =
IAbs(dist[0]);
524 dist[1] = plane[1] !=
nullptr
526 : std::numeric_limits<float>::max();
527 dist[2] = plane[2] !=
nullptr
529 : std::numeric_limits<float>::max();
530 dist[3] = plane[3] !=
nullptr
532 : std::numeric_limits<float>::max();
533 for (i = 1; i < 4; ++i) {
534 if (min_abs_dist >
IAbs(dist[i])) {
535 min_abs_dist =
IAbs(dist[i]);
540 height_above_ground[pos] = dist[id];
544 for (c = 1; c < nm1; ++c) {
550 iter = (*vg_coarse_)(r, c).indices_.cbegin();
551 while (iter < (*
vg_coarse_)(r, c).indices_.cend()) {
553 assert(pos <
static_cast<int>(nr_points));
555 cptr = point_cloud + (nr_point_elements * pos);
556 dist[0] = plane[0] !=
nullptr
558 : std::numeric_limits<float>::max();
559 min_abs_dist =
IAbs(dist[0]);
562 dist[1] = plane[1] !=
nullptr
564 : std::numeric_limits<float>::max();
565 dist[2] = plane[2] !=
nullptr
567 : std::numeric_limits<float>::max();
568 dist[3] = plane[3] !=
nullptr
570 : std::numeric_limits<float>::max();
571 dist[4] = plane[4] !=
nullptr
573 : std::numeric_limits<float>::max();
574 for (i = 1; i < 5; ++i) {
575 if (min_abs_dist >
IAbs(dist[i])) {
576 min_abs_dist =
IAbs(dist[i]);
581 height_above_ground[pos] = dist[id];
586 plane[1] = cn[nm1 - 1].
IsValid() ? cn[nm1 - 1].
params :
nullptr;
589 iter = (*vg_coarse_)(r, nm1).indices_.cbegin();
590 while (iter < (*
vg_coarse_)(r, nm1).indices_.cend()) {
592 assert(pos <
static_cast<int>(nr_points));
594 cptr = point_cloud + (nr_point_elements * pos);
595 dist[0] = plane[0] !=
nullptr
597 : std::numeric_limits<float>::max();
598 min_abs_dist =
IAbs(dist[0]);
602 dist[1] = plane[1] !=
nullptr
604 : std::numeric_limits<float>::max();
605 dist[2] = plane[2] !=
nullptr
607 : std::numeric_limits<float>::max();
608 dist[3] = plane[3] !=
nullptr
610 : std::numeric_limits<float>::max();
611 for (i = 1; i < 4; ++i) {
612 if (min_abs_dist >
IAbs(dist[i])) {
613 min_abs_dist =
IAbs(dist[i]);
618 height_above_ground[pos] = dist[id];
624 const float *point_cloud,
626 unsigned int nr_points,
627 unsigned int nr_point_element) {
640 for (i = 0; i < vx.
NrPoints(); ++i) {
641 pos = vx.
indices_[i] * nr_point_element;
647 static_cast<int>(vx.
NrPoints()), &rseed);
649 for (i = 0; i < nr_samples; ++i) {
657 nr_points, nr_point_element, nr_samples);
673 nr_points, nr_point_element);
682 memset(
reinterpret_cast<void *
>(
labels_), 0,
696 const int *semantic_list,
const std::vector<int> &indices,
698 unsigned int nr_point_element) {
699 const float pi = 3.1415926535898;
700 const float *pt_ptr =
nullptr;
701 const int *semantic_value =
nullptr;
706 size_t ground_count = 0, valid_count = 0;
707 float ground_hei = 0.0, valid_hei = 0.0;
711 for (
size_t i = 0; i < indices.size(); i++) {
712 int pos = indices[i];
713 pt_ptr = point_cloud + (pos * nr_point_element);
715 semantic_value = semantic_list + pos;
716 int value = semantic_value[0];
722 if (ground_count > 0.3 * indices.size() && ground_count > 0) {
723 ground_hei = (ground_hei * 1.0f / ground_count);
727 for (
size_t i = 0; i < indices.size(); i++) {
728 int pos = indices[i];
729 pt_ptr = point_cloud + (pos * nr_point_element);
731 semantic_value = semantic_list + pos;
732 int value = semantic_value[0];
736 if (z > ground_hei - 3 * delta && z < ground_hei + 3 * delta) {
745 if (z > ground_hei - 2 * delta && z < ground_hei + 2 * delta) {
756 if (valid_count > 0) {
757 valid_hei = (valid_hei * 1.0f / valid_count);
765 const float *point_cloud,
const int *semantic_list,
767 unsigned int nr_point_element) {
768 const float pi = 3.1415926535898;
769 unsigned int nr_contradi = 0;
770 const float *pt_ptr =
nullptr;
771 const int *semantic_value =
nullptr;
772 auto voxel = (*vg_fine_)(row, col);
779 std::vector<std::pair<int, int>> neigh;
783 for (
size_t i = 0; i < indices.size(); i++) {
787 int pos = indices[i];
788 pt_ptr = point_cloud + (pos * nr_point_element);
790 float candidata_z = 0.0;
794 if (fabs(z - candidata_z) < 2 * delta) {
802 for (
size_t jj = 0; jj < neigh.size(); jj++) {
803 int rr = neigh[jj].first;
804 int cc = neigh[jj].second;
807 if (fabs(z - candidata_z) < 2 * delta) {
818 count + valid_count > 0.9 *
827 std::vector<float> sample_z;
828 unsigned int voxel_points = voxel.NrPoints();
830 unsigned int nr_z_comp_fail_threshold =
832 sample_z.resize(nr_samples);
835 for (
size_t ii = 0; ii < voxel_points; ++ii) {
836 int pos = voxel.indices_[ii] * nr_point_element;
837 sample_z[ii] = (point_cloud + pos)[2];
843 for (
size_t ii = 0; ii < nr_samples; ++ii) {
845 sample_z[ii] = (point_cloud + pos)[2];
850 for (
size_t i = 0; i < indices.size(); i++) {
854 int pos = indices[i];
856 semantic_value = semantic_list + pos;
857 int value = semantic_value[0];
865 count + valid_count > 0.9 *
869 pt_ptr = point_cloud + (pos * nr_point_element);
889 if (nr_samples > nr_z_comp_fail_threshold) {
890 for (
size_t jj = 0; jj < nr_samples; ++jj) {
891 float delta_z =
IAbs(sample_z[jj] - z);
894 if (nr_contradi > nr_z_comp_fail_threshold) {
900 if (nr_contradi <= nr_z_comp_fail_threshold) {
910 memset(
reinterpret_cast<void *
>(
labels_), 0,
920 std::stringstream sstr;
927 auto voxel = (*vg_fine_)(r, c);
931 if (voxel.indices_.size() < 1) {
943 auto voxel = (*vg_fine_)(r, c);
945 sstr <<
"row = " << r <<
" col = " << c
946 <<
" center_x = " << voxel.v_[0] + voxel.dim_x_ * 0.5f
947 <<
" center_y = " << voxel.v_[1] + voxel.dim_y_ * 0.5f
948 <<
" total_indices = " << voxel.indices_.size()
951 <<
" ground_count = "
953 <<
" ground_height = "
959 <<
" valid_height = "
967 sstr <<
" no necessary to get neighbor." << std::endl;
976 sstr <<
" after neighbor_count = " << count << std::endl;
989 unsigned int nr_points,
990 unsigned int nr_point_element,
999 float ptp_dist = 0.0f;
1000 float fit_cost = 0.0f;
1001 float fit_cost_best = dist_thre;
1003 int nr_inliers_best = -1;
1007 int indices_trial[] = {0, 0, 0};
1010 int nr_inliers_termi =
IRound(
static_cast<float>(nr_samples) *
1015 float *psrc =
nullptr;
1017 for (i = 0; i < nr_samples; ++i) {
1018 assert((*candi)[i] <
static_cast<int>(nr_points));
1019 ICopy3(point_cloud + (nr_point_element * (*candi)[i]), pdst);
1025 IScale3(indices_trial, dim_point_);
1039 for (j = 0; j < nr_samples; ++j) {
1041 if (ptp_dist < dist_thre) {
1043 fit_cost += ptp_dist;
1050 fit_cost = nr_inliers > 0 ? (fit_cost /
static_cast<float>(nr_inliers))
1053 if (nr_inliers >= nr_inliers_best) {
1054 if (nr_inliers == nr_inliers_best) {
1055 if (fit_cost < fit_cost_best) {
1056 nr_inliers_best = nr_inliers;
1057 fit_cost_best = fit_cost;
1058 *groundplane = plane;
1061 nr_inliers_best = nr_inliers;
1062 fit_cost_best = fit_cost;
1063 *groundplane = plane;
1066 if (nr_inliers_best > nr_inliers_termi) {
1072 if (!groundplane->
IsValid()) {
1085 for (i = 0; i < nr_samples; ++i) {
1087 if (ptp_dist < dist_thre) {
1138 std::vector<std::pair<int, int>> *neighbors,
1139 unsigned int nr_point_element) {
1146 std::vector<int> filtered_indices;
1147 filtered_indices.reserve(candi->
Size());
1148 for (i = 0; i < neighbors->size(); ++i) {
1149 r_n = (*neighbors)[i].first;
1150 c_n = (*neighbors)[i].second;
1157 avg_z /=
static_cast<float>(count);
1160 for (i = 0; i < candi->
Size(); ++i) {
1161 z = (point_cloud + (nr_point_element * (*candi)[i]))[2];
1164 filtered_indices.push_back((*candi)[i]);
1169 if (filtered_indices.size() != candi->
Size()) {
1170 candi->
indices.assign(filtered_indices.begin(), filtered_indices.end());
1180 return IAcos(numerator *
IRec(denominator));
1185 unsigned int nr_points,
unsigned int nr_point_element,
float dist_thre) {
1191 std::vector<std::pair<int, int>> neighbors;
1209 float ptp_dist = 0.0f;
1212 int nr_inliers_best = -1;
1213 float angle_best = std::numeric_limits<float>::max();
1216 int indices_trial[] = {0, 0, 0};
1219 int nr_inliers_termi =
IRound(
static_cast<float>(nr_samples) *
1224 float *psrc =
nullptr;
1229 for (
int i = 0; i < nr_samples; ++i) {
1230 assert(candi[i] <
static_cast<int>(nr_points));
1231 ICopy3(point_cloud + (nr_point_element * candi[i]), pdst);
1237 IScale3(indices_trial, dim_point_);
1250 for (
int j = 0; j < nr_samples; ++j) {
1252 if (ptp_dist < dist_thre) {
1261 if (nr_inliers > nr_inliers_termi) {
1266 for (
size_t i = 0; i < neighbors.size(); ++i) {
1267 r_n = neighbors[i].first;
1268 c_n = neighbors[i].second;
1274 for (
int j = 0; j < nr_samples; ++j) {
1277 if (ptp_dist < dist_thre) {
1291 nr_inliers_best = -1;
1292 for (
int i = 0; i < kNr_iter; ++i) {
1293 if (!(hypothesis[i].IsValid())) {
1297 if (nr_inliers >= nr_inliers_best) {
1298 if (nr_inliers == nr_inliers_best) {
1300 if (angle < angle_best && angle > 0) {
1305 nr_inliers_best = nr_inliers;
1312 *groundplane = hypothesis[best];
1315 if (!groundplane->
IsValid()) {
1330 for (
int i = 0; i < nr_samples; ++i) {
1332 if (ptp_dist < dist_thre) {
1344 *groundplane = hypothesis[best];
1354 const auto &voxel_cur = (*vg_coarse_)(r, c);
1355 float radius = voxel_cur.dim_x_ * 0.5f;
1356 float cx = voxel_cur.v_[0] + radius;
1357 float cy = voxel_cur.v_[1] + radius;
1358 float cz = -(groundplane->
params[0] * cx + groundplane->
params[1] * cy +
1359 groundplane->
params[3]) /
1369 const std::vector<std::pair<int, int>> &neighbors) {
1370 float angle_dist = 0.0f;
1375 for (j = 0; j < neighbors.size(); ++j) {
1376 r_n = neighbors[j].first;
1377 c_n = neighbors[j].second;
1386 return angle_dist /
static_cast<float>(count);
1402 std::stringstream sstr;
1403 sstr <<
"[GroundFitInfo] " << std::to_string(
frame_timestamp_) << std::endl;
1410 sstr <<
"[FitInOrder] row = " << r <<
" col = " << c
1412 << (*vg_coarse_)(r, c).v_[0] + (*
vg_coarse_)(r, c).dim_x_ * 0.5f
1416 <<
" [AfterFilterCandidates] count = " <<
local_candis_[r][c].Size();
1418 float max_z = -5.0, min_z = 5.0;
1433 sstr <<
" sample_point_cooridinate = (" << x <<
", " << y
1434 <<
", " << z <<
")";
1437 sstr <<
" min_z = " << min_z <<
" max_z= " << max_z;
1454 <<
" [AfterGridPlaneFit] ground_z_valid = " <<
ground_z_[r][c].second
1455 <<
" ground_z_value = " <<
ground_z_[r][c].first
1457 <<
" plane_invalid_status = "
1468 AINFO << sstr.str();
1470 <<
" ground_count is " << count;
1477 int r,
int c,
int rows,
int cols,
1478 std::vector<std::pair<int, int>> *neighbors) {
1479 int left =
IMax(0, c - 1);
1480 int right =
IMin(cols - 1, c + 1);
1481 int up =
IMax(0, r - 1);
1482 int down =
IMin(rows - 1, r + 1);
1485 neighbors->reserve(8);
1486 for (x = left; x <= right; ++x) {
1487 for (y = up; y <= down; ++y) {
1488 if (x == c && y == r) {
1491 neighbors->push_back(std::pair<int, int>(y, x));
1519 for (c = 1; c < nm1; ++c) {
1556 int supports[] = {0, 0, 0, 0};
1557 float weights[] = {0.f, 0.f, 0.f, 0.f};
1563 int support_sum = 0;
1564 support_sum =
ISum4(supports);
1569 static_cast<float>(supports[0]) /
static_cast<float>(support_sum);
1571 static_cast<float>(supports[1]) /
static_cast<float>(support_sum);
1573 static_cast<float>(supports[2]) /
static_cast<float>(support_sum);
1575 static_cast<float>(supports[3]) /
static_cast<float>(support_sum);
1578 weights[2] * up.
theta + weights[3] * dn.
theta;
1579 gp->
phi = weights[0] * lt.
phi + weights[1] * rt.
phi + weights[2] * up.
phi +
1580 weights[3] * dn.
phi;
1581 gp->
d = weights[0] * lt.
d + weights[1] * rt.
d + weights[2] * up.
d +
1584 support_sum =
IMax(((support_sum + 2) >> 2), 1);
1595 int supports[] = {0, 0, 0, 0, 0};
1596 float weights[] = {0.f, 0.f, 0.f, 0.f, 0.f};
1618 int support_sum = 0;
1619 support_sum =
ISum4(supports);
1620 if (support_sum == 0) {
1624 support_sum += supports[4];
1626 static_cast<float>(supports[0]) /
static_cast<float>(support_sum);
1628 static_cast<float>(supports[1]) /
static_cast<float>(support_sum);
1630 static_cast<float>(supports[2]) /
static_cast<float>(support_sum);
1632 static_cast<float>(supports[3]) /
static_cast<float>(support_sum);
1634 static_cast<float>(supports[4]) /
static_cast<float>(support_sum);
1637 weights[2] * up.
theta + weights[3] * dn.
theta +
1638 weights[4] * g.
theta;
1639 gp->
phi = weights[0] * lt.
phi + weights[1] * rt.
phi + weights[2] * up.
phi +
1640 weights[3] * dn.
phi + weights[4] * g.
phi;
1641 gp->
d = weights[0] * lt.
d + weights[1] * rt.
d + weights[2] * up.
d +
1642 weights[3] * dn.
d + weights[4] * g.
d;
1644 support_sum =
IMax(((support_sum + 2) >> 3), 1);
1656 for (r = 1; r < nm1; ++r) {
1670 unsigned int offset = 0;
1671 for (
unsigned int i = 0; i < lap_size; ++i) {
1675 for (
unsigned int i = 0; i < lap_size; ++i) {
1679 for (
unsigned int i = 0; i < lap_size; ++i) {
1698 for (
unsigned int i = 0; i < lap_size; ++i) {
1706 Eigen::SparseMatrix<float> in;
1707 Eigen::SparseMatrix<float> out;
1708 memset((
void*)
weight_buffer_[0], 0, 2 * lap_size *
sizeof(
float));
1710 for (i = 0; i < lap_size; ++i) {
1712 std::exp((
inliers_[i] - 8) / 20) : 0.1;
1715 for (i = 0; i < lap_size; ++i) {
1721 for (i = 0; i < lap_size; ++i) {
1725 a_array_.coeffRef(i + lap_size, i) = 0.0;
1736 for (i = 0; i < lap_size; ++i) {
1738 b_array_.coeffRef(i + lap_size, 0) =
1740 b_array_.coeffRef(i + lap_size, 1) =
1742 b_array_.coeffRef(i + lap_size, 2) =
1745 b_array_.coeffRef(i + lap_size, 0) = 0.0;
1746 b_array_.coeffRef(i + lap_size, 1) = 0.0;
1747 b_array_.coeffRef(i + lap_size, 2) = 0.0;
1752 for (i = 0; i < lap_size; ++i) {
1765 float dist_thre = 0.0;
1766 float ptp_dist = 0.0;
1787 for (i = 0; i < nr_samples; ++i) {
1788 assert(candi[i] < (
int)nr_points);
1789 ICopy3(point_cloud + (nr_point_element * candi[i]), psrc);
1791 if (ptp_dist < dist_thre) {
1801 if (angle > threshold_rad) {
1814 unsigned int offset = 0;
1825 for (
unsigned int i = 0; i < lap_size; ++i) {
1829 for (
unsigned int i = 0; i < lap_size; ++i) {
1833 for (
unsigned int i = 0; i < lap_size; ++i) {
1856 int last_col =
IMax(0, col - 1);
1857 int next_col =
IMin(cols - 1, col + 1);
1858 int last_row =
IMax(0, row - 1);
1859 int next_row =
IMin(rows - 1, row + 1);
1891 parsing_ground_z - buffer);
1893 parsing_ground_z + buffer);
1900 const int* semantic_value,
float *height_above_ground,
1901 unsigned int nr_points,
unsigned int nr_point_elements) {
1902 assert(point_cloud !=
nullptr);
1903 assert(semantic_value !=
nullptr);
1904 assert(height_above_ground !=
nullptr);
1906 assert(nr_point_elements >= 3);
1909 nr_points, nr_point_elements)) {
1914 nr_points, nr_point_elements)) {
1987 float voxel_width_x_rec =
IRec(voxel_width_x);
1988 float voxel_width_y_rec =
IRec(voxel_width_y);
1990 *col =
IMin(grid_size - 1,
static_cast<int>(
1992 *row =
IMin(grid_size - 1,
static_cast<int>(
2016 return std::numeric_limits<float>::max();
2053 float ny_over_nz =
ITan(src.
phi);
2054 float nz =
ISqrt((1 - nx * nx) / (1 + ny_over_nz * ny_over_nz));
2055 float ny = nz * ny_over_nz;
PlaneFitGroundDetectorParam & param_
unsigned int GetGridDimX() const
int FitGrid(const float *point_cloud, PlaneFitPointCandIndices *candi, GroundPlaneLiDAR *groundplane, unsigned int nr_points, unsigned int nr_point_element, float dist_thre)
void SetGroundPlaneSpherParams(float *params)
Eigen::SparseMatrix< float > b_array_
unsigned int GetGridDimY() const
int SmoothLine(unsigned int up, unsigned int r, unsigned int dn)
void SelectGroundCandidate(const float *point_cloud, const int *semantic_list, const std::vector< int > &indices, PlaneFitPointCandIndices *candi, GroundCandidateIndices *ground_candi, unsigned int nr_point_element)
float CalculateAngleDist(const GroundPlaneLiDAR &plane, const std::vector< std::pair< int, int > > &neighbors)
float * sampled_z_values_
const GroundPlaneLiDAR * GetGroundPlane(int r, int c) const
void GetInliers(int *inliers)
GroundPlaneLiDAR ** ground_planes_
~PlaneFitGroundDetector()
PlaneFitGroundDetector(PlaneFitGroundDetectorParam ¶m)
void UpdateParams(float parsing_ground_z, float buffer, double timestamp)
bool Detect(const float *point_cloud, const int *semantic_value, float *height_above_ground, unsigned int nr_points, unsigned int nr_point_elements)
int FitLine(unsigned int r)
VoxelGridXY< float > * vg_fine_
unsigned int * map_fine_to_coarse_
void ComputeAdaptiveThreshold()
int CompleteGrid(const GroundPlaneSpherical <, const GroundPlaneSpherical &rt, const GroundPlaneSpherical &up, const GroundPlaneSpherical &dn, GroundPlaneSpherical *gp)
void ResetParams(float ori_z_lower, float ori_z_upper)
int FilterGrid(const Voxel< float > &vg, const float *point_cloud, PlaneFitPointCandIndices *candi, unsigned int nr_points, unsigned int nr_point_element)
void InitOrderTable(const VoxelGridXY< float > *vg, std::pair< int, int > *order)
Eigen::SimplicialLDLT< Eigen::SparseMatrix< float > > solver_
void ComputeSignedGroundHeight(const float *point_cloud, float *height_above_ground, unsigned int nr_points, unsigned int nr_point_elements)
int FitGridWithNeighbors(int r, int c, const float *point_cloud, GroundPlaneLiDAR *groundplane, unsigned int nr_points, unsigned int nr_point_element, float dist_thre)
std::vector< std::vector< unsigned int > > neighbors_
void GetNeighbors(int r, int c, int rows, int cols, std::vector< std::pair< int, int > > *neighbors)
std::pair< float, bool > ** ground_z_
const VoxelGridXY< float > * GetGrid() const
GroundCandidateIndices ** ground_candidates_
VoxelGridXY< float > * vg_coarse_
Eigen::SparseMatrix< float > a_array_
const char * GetLabel() const
int SmoothGrid(const GroundPlaneSpherical &g, const GroundPlaneSpherical <, const GroundPlaneSpherical &rt, const GroundPlaneSpherical &up, const GroundPlaneSpherical &dn, GroundPlaneSpherical *gp)
void GetGroundPlaneSpherParams(float *params)
int NeighborGroundCandidate(int row, int col, const float *point_cloud, const int *semantic_list, const std::vector< int > &indices, PlaneFitPointCandIndices *candi, unsigned int nr_point_element)
PlaneFitPointCandIndices ** local_candis_
int FilterLine(unsigned int r)
GroundPlaneSpherical ** ground_planes_sphe_
int FilterCandidates(int r, int c, const float *point_cloud, PlaneFitPointCandIndices *candi, std::vector< std::pair< int, int > > *neighbors, unsigned int nr_point_element)
void ComputeSignedGroundHeightLine(const float *point_cloud, const GroundPlaneLiDAR *up, const GroundPlaneLiDAR *cn, const GroundPlaneLiDAR *dn, float *height_above_ground, unsigned int r, unsigned int nr_points, unsigned int nr_point_elements)
int CompareZ(const float *point_cloud, const std::vector< int > &point_indices, const float *z_values, PlaneFitPointCandIndices *candi, unsigned int nr_points, unsigned int nr_point_element, unsigned int nr_compares)
std::pair< int, int > * order_table_
void Pc2Voxel(float x, float y, float z, int *row, int *col)
PlaneFitPointCandIndices ** GetCandis() const
unsigned int NrVoxelX() const
unsigned int NrPoints() const
unsigned int NrVoxel() const
unsigned int NrPointElement() const
unsigned int NrVoxelY() const
const std::vector< Voxel< T > > & GetConstVoxels() const
const T * const_data() const
bool Alloc(unsigned int nr_voxel_x, unsigned int nr_voxel_y, T spatial_bound_x_min, T spatial_bound_x_max, T spatial_bound_y_min, T spatial_bound_y_max, T spatial_bound_z_min, T spatial_bound_z_max)
bool SetS(const float *data, const int *semantic_data, unsigned int nr_points, unsigned int nr_point_element)
const int * const_semantic_data() const
unsigned int NrPoints() const
std::vector< int > indices_
void IPlaneFitDestroyed(T *Xs, T *pi)
void IRandomizedShuffle1(T *A, int n, int *s)
void ICopy3(const T src[3], T dst[3])
void IPlaneEucliToSpher(const GroundPlaneLiDAR &src, GroundPlaneSpherical *dst)
double IL2Norm(const unsigned char *x, int n)
void IMinMaxElements(const T *a, int n, T *min_val, T *max_val)
float calculate_two_angles(const GroundPlaneLiDAR &p1, const GroundPlaneLiDAR &p2)
T IPlaneToPointDistanceWUnitNorm(const T *pi, const T *p)
float IDiv(float a, float b)
T IPlaneToPointSignedDistanceWUnitNorm(const T *pi, const T *p)
void IPlaneFitTotalLeastSquare(T *X, T *pi, int n)
float IAtan2(float y, float x)
void IScale3(T x[3], T sf)
void IPlaneSpherToEucli(const GroundPlaneSpherical &src, GroundPlaneLiDAR *dst)
void IRandomSample(int *sample, int n, int pool_size, int *s)
T IDot3(const T x[3], const T y[3])
void SetGroundFlag(bool flag)
void SetGroundCount(int value)
void SetGroundHeight(float value)
void SetValidCount(int value)
void Resize(int size, bool flag)
void SetValidFlag(bool flag)
void SetVisitedTrue(int index)
void SetValidHeight(float value)
std::string GetInvalidStatus() const
void SetStatus(bool flag)
std::string GetOrigin() const
float GetDegreeNormalToZ() const
void SetOrigin(std::string origin)
void ForcePositiveNormalZ()
void SetInvalidStatus(std::string flag)
void SetNrSupport(int nr)
void SetStatus(bool flag)
void SetNrSupport(int nr)
int nr_ransac_iter_threshold
unsigned int nr_samples_min_threshold
float planefit_dist_threshold_far
float termi_inlier_percen_threshold
unsigned int nr_grids_fine
unsigned int nr_z_comp_candis
unsigned int nr_inliers_min_threshold
float planefit_filter_threshold
float sample_region_z_lower
unsigned int nr_points_max
float planefit_dist_threshold_near
int semantic_ground_value
unsigned int nr_grids_coarse
float planefit_orien_threshold
float candidate_filter_threshold
unsigned int nr_samples_max_threshold
unsigned int nr_z_comp_fail_threshold
float sample_region_z_upper
std::vector< int > indices
unsigned int Size() const
int Prune(unsigned int min_nr_samples, unsigned int max_nr_samples)
void Reserve(unsigned int size)