60 if (threshold_ == std::numeric_limits<double>::max())
62 PCL_ERROR (
"[pcl::RandomSampleConsensus::computeModel] No threshold set!\n");
68 double k = std::numeric_limits<double>::max();
74 const double one_over_indices = 1.0 /
static_cast<double> (sac_model_->getIndices ()->size ());
79 const unsigned max_skip = max_iterations_ * 10;
81 int threads = threads_;
84#if OPENMP_AVAILABLE_RANSAC
88 PCL_DEBUG (
"[pcl::RandomSampleConsensus::computeModel] Automatic number of threads requested, choosing %i threads.\n", threads);
92 PCL_WARN (
"[pcl::RandomSampleConsensus::computeModel] Parallelization is requested, but OpenMP 3.1 is not available! Continuing without parallelization.\n");
97#if OPENMP_AVAILABLE_RANSAC
98#pragma omp parallel if(threads > 0) num_threads(threads) shared(k, skipped_count, n_best_inliers_count) firstprivate(selection, model_coefficients)
101#if OPENMP_AVAILABLE_RANSAC
104 PCL_DEBUG (
"[pcl::RandomSampleConsensus::computeModel] Computing in parallel with up to %i threads.\n",
omp_get_num_threads());
107 PCL_DEBUG (
"[pcl::RandomSampleConsensus::computeModel] Computing not parallel.\n");
113#if OPENMP_AVAILABLE_RANSAC
114#pragma omp critical(samples)
117 sac_model_->getSamples (iterations_,
selection);
122 PCL_ERROR (
"[pcl::RandomSampleConsensus::computeModel] No samples could be selected!\n");
131#if OPENMP_AVAILABLE_RANSAC
132#pragma omp atomic capture
149#if OPENMP_AVAILABLE_RANSAC
150#pragma omp atomic read
156#if OPENMP_AVAILABLE_RANSAC
157#pragma omp critical(update)
182#if OPENMP_AVAILABLE_RANSAC
183#pragma omp atomic capture
186#if OPENMP_AVAILABLE_RANSAC
187#pragma omp atomic read
190#if OPENMP_AVAILABLE_RANSAC
199 PCL_DEBUG (
"[pcl::RandomSampleConsensus::computeModel] RANSAC reached the maximum number of trials.\n");
205 PCL_DEBUG (
"[pcl::RandomSampleConsensus::computeModel] Model: %lu size, %u inliers.\n", model_.size (),
n_best_inliers_count);
209 PCL_ERROR (
"[pcl::RandomSampleConsensus::computeModel] RANSAC found no model.\n");
215 sac_model_->selectWithinDistance (model_coefficients_, threshold_, inliers_);