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

Speed-up SampleConsensusModel::computeVariance #1285

Merged
merged 1 commit into from
Jul 28, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Speed-up computeVariance
  • Loading branch information
Vladimir-Engelgardt committed Jul 27, 2015
commit 2911c52b0cfcbc0447ae6e7034ea465f5729fcdf
5 changes: 3 additions & 2 deletions sample_consensus/include/pcl/sample_consensus/sac_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,9 @@ namespace pcl
computeVariance (const std::vector<double> &error_sqr_dists)
{
std::vector<double> dists (error_sqr_dists);
std::sort (dists.begin (), dists.end ());
double median_error_sqr = dists[dists.size () >> 1];
const size_t medIdx = dists.size () >> 1;
std::nth_element (dists.begin (), dists.begin () + medIdx, dists.end ());
double median_error_sqr = dists[medIdx];
return (2.1981 * median_error_sqr);
}

Expand Down