Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ransac] Refactor ransac_ground.h #14

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

VasiliyMatr
Copy link

  • Refactor find_inlier_indices function:

    • Rewrite algo - replace translations with signed distances calculation.
    • Replace std::function with template argument for better inlining.
    • Use template iterators instead of fixed input container.
  • Refactor remove_ground_ransac function:

    • Improve complexity: O(N * logN) -> O(N)
    • Add checks: for sample plane normal vector validity, for resulting best pair validity
    • Use std::vector instead of std::shared_ptr whenever it is possible without API change
  • A few other improvements

- Refactor find_inlier_indices function:
  - Replace std::function with template argument for better inlining
  - Rewrite algo - replace translations with signed distances calculation

- Refactor remove_ground_ransac function:
  - Calculate number of ransac iterations for given error probability and
expected plane point share
  - Improve complexity: O(N * logN) -> O(N)
  - Replace unnecessary shared pointers
  - A few other improvements
- Refactor remove_ground_ransac function:
  - Add check for sample plane normal vector validity
  - Add check for resulting best pair validity
- Refactor remove_ground_ransac and find_inlier_indices functions:
  - Use std::vector instead of std::shared_ptr whenever it is possible without API change
  - Refactor find_inlier_indices in a std::algo manner - use input iterators
- Add SFINAE input iterator check in find_inlier_indices function header
Copy link
Owner

@Obs01ete Obs01ete left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though the task asked for a complete re-implementation, this code refactoring is okay since the amound and depth of changes is significant. Accepted.

// To reduce the number of outliers (non-ground points) we can roughly crop
// the point cloud by Z coordinate in the range (-rough_filter_thr, rough_filter_thr).
// Simultaneously we perform decimation of the remaining points since the full
// point cloud is excessive for RANSAC.
std::mt19937::result_type decimation_seed = 41;
std::mt19937 rng_decimation(decimation_seed);
std::mt19937 rng_decimation(std::random_device {}());
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"std::random_device is a uniformly-distributed integer random number generator that produces non-deterministic random numbers."

This is not good for reproducability. No benefit over the pseudo RNG.


EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};

// Helper alias for input iterator SFINAE check
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a random over-engineering. Why do we need this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants