Go to the documentation of this file.00001 #ifndef PCL_TRACKING_IMPL_PARTICLE_OMP_FILTER_H_
00002 #define PCL_TRACKING_IMPL_PARTICLE_OMP_FILTER_H_
00003
00004 template <typename PointInT, typename StateT> void
00005 pcl::tracking::ParticleFilterOMPTracker<PointInT, StateT>::weight ()
00006 {
00007 if (!use_normal_)
00008 {
00009 #pragma omp parallel for schedule (dynamic, threads_)
00010 for (int i = 0; i < particle_num_; i++)
00011 this->computeTransformedPointCloudWithoutNormal (particles_->points[i], *transed_reference_vector_[i]);
00012
00013 PointCloudInPtr coherence_input (new PointCloudIn);
00014 this->cropInputPointCloud (input_, *coherence_input);
00015 if (change_counter_ == 0)
00016 {
00017
00018 if (!use_change_detector_ || this->testChangeDetection (coherence_input))
00019 {
00020 changed_ = true;
00021 change_counter_ = change_detector_interval_;
00022 coherence_->setTargetCloud (coherence_input);
00023 coherence_->initCompute ();
00024 #pragma omp parallel for schedule (dynamic, threads_)
00025 for (int i = 0; i < particle_num_; i++)
00026 {
00027 IndicesPtr indices;
00028 coherence_->compute (transed_reference_vector_[i], indices, particles_->points[i].weight);
00029 }
00030 }
00031 else
00032 changed_ = false;
00033 }
00034 else
00035 {
00036 --change_counter_;
00037 coherence_->setTargetCloud (coherence_input);
00038 coherence_->initCompute ();
00039 #pragma omp parallel for schedule (dynamic, threads_)
00040 for (int i = 0; i < particle_num_; i++)
00041 {
00042 IndicesPtr indices;
00043 coherence_->compute (transed_reference_vector_[i], indices, particles_->points[i].weight);
00044 }
00045 }
00046 }
00047 else
00048 {
00049 std::vector<IndicesPtr> indices_list (particle_num_);
00050 for (int i = 0; i < particle_num_; i++)
00051 {
00052 indices_list[i] = IndicesPtr (new std::vector<int>);
00053 }
00054 #pragma omp parallel for schedule (dynamic, threads_)
00055 for (int i = 0; i < particle_num_; i++)
00056 {
00057 this->computeTransformedPointCloudWithNormal (particles_->points[i], *indices_list[i], *transed_reference_vector_[i]);
00058 }
00059
00060 PointCloudInPtr coherence_input (new PointCloudIn);
00061 this->cropInputPointCloud (input_, *coherence_input);
00062
00063 coherence_->setTargetCloud (coherence_input);
00064 coherence_->initCompute ();
00065 #pragma omp parallel for schedule (dynamic, threads_)
00066 for (int i = 0; i < particle_num_; i++)
00067 {
00068 coherence_->compute (transed_reference_vector_[i], indices_list[i], particles_->points[i].weight);
00069 }
00070 }
00071
00072 normalizeWeight ();
00073 }
00074
00075 #define PCL_INSTANTIATE_ParticleFilterOMPTracker(T,ST) template class PCL_EXPORTS pcl::tracking::ParticleFilterOMPTracker<T,ST>;
00076
00077 #endif