Skip to content

Commit

Permalink
Merge pull request #1285 from Vladimir-Engelgardt/compVariance
Browse files Browse the repository at this point in the history
Speed-up SampleConsensusModel::computeVariance
  • Loading branch information
taketwo committed Jul 28, 2015
2 parents 7bf2996 + 2911c52 commit 77edc1b
Showing 1 changed file with 3 additions and 2 deletions.
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

0 comments on commit 77edc1b

Please sign in to comment.