Point Cloud Library (PCL) 1.12.1
particle_filter_omp.h
1#pragma once
2
3#include <pcl/tracking/coherence.h>
4#include <pcl/tracking/particle_filter.h>
5#include <pcl/tracking/tracking.h>
6
7namespace pcl {
8namespace tracking {
9/** \brief @b ParticleFilterOMPTracker tracks the PointCloud which is given by
10 * setReferenceCloud within the measured PointCloud using particle filter method in
11 * parallel, using the OpenMP standard. \author Ryohei Ueda \ingroup tracking
12 */
13template <typename PointInT, typename StateT>
14class ParticleFilterOMPTracker : public ParticleFilterTracker<PointInT, StateT> {
15public:
16 using Tracker<PointInT, StateT>::tracker_name_;
17 using Tracker<PointInT, StateT>::search_;
18 using Tracker<PointInT, StateT>::input_;
19 using Tracker<PointInT, StateT>::indices_;
20 using Tracker<PointInT, StateT>::getClassName;
21 using ParticleFilterTracker<PointInT, StateT>::particles_;
22 using ParticleFilterTracker<PointInT, StateT>::change_detector_;
23 using ParticleFilterTracker<PointInT, StateT>::change_counter_;
25 using ParticleFilterTracker<PointInT, StateT>::use_change_detector_;
26 using ParticleFilterTracker<PointInT, StateT>::alpha_;
27 using ParticleFilterTracker<PointInT, StateT>::changed_;
28 using ParticleFilterTracker<PointInT, StateT>::coherence_;
29 using ParticleFilterTracker<PointInT, StateT>::use_normal_;
30 using ParticleFilterTracker<PointInT, StateT>::particle_num_;
33 // using ParticleFilterTracker<PointInT, StateT>::calcLikelihood;
34 using ParticleFilterTracker<PointInT, StateT>::normalizeWeight;
36 using ParticleFilterTracker<PointInT, StateT>::calcBoundingBox;
37
39
41 using PointCloudInPtr = typename PointCloudIn::Ptr;
42 using PointCloudInConstPtr = typename PointCloudIn::ConstPtr;
43
45 using PointCloudStatePtr = typename PointCloudState::Ptr;
46 using PointCloudStateConstPtr = typename PointCloudState::ConstPtr;
47
49 using CoherencePtr = typename Coherence::Ptr;
51
55
56 /** \brief Initialize the scheduler and set the number of threads to use.
57 * \param nr_threads the number of hardware threads to use (0 sets the value
58 * back to automatic)
59 */
60 ParticleFilterOMPTracker(unsigned int nr_threads = 0)
61 : ParticleFilterTracker<PointInT, StateT>()
62 {
63 tracker_name_ = "ParticleFilterOMPTracker";
64
65 setNumberOfThreads(nr_threads);
66 }
67
68 /** \brief Initialize the scheduler and set the number of threads to use.
69 * \param nr_threads the number of hardware threads to use (0 sets the value
70 * back to automatic)
71 */
72 void
73 setNumberOfThreads(unsigned int nr_threads = 0);
74
75protected:
76 /** \brief The number of threads the scheduler should use. */
77 unsigned int threads_;
78
79 /** \brief weighting phase of particle filter method. calculate the likelihood of all
80 * of the particles and set the weights.
81 */
82 void
83 weight() override;
84};
85} // namespace tracking
86} // namespace pcl
87
88//#include <pcl/tracking/impl/particle_filter_omp.hpp>
89#ifdef PCL_NO_PRECOMPILE
90#include <pcl/tracking/impl/particle_filter_omp.hpp>
91#endif
PointCloudConstPtr input_
The input point cloud dataset.
Definition: pcl_base.h:147
IndicesPtr indices_
A pointer to the vector of point indices to use.
Definition: pcl_base.h:150
ParticleFilterOMPTracker tracks the PointCloud which is given by setReferenceCloud within the measure...
void weight() override
weighting phase of particle filter method.
ParticleFilterOMPTracker(unsigned int nr_threads=0)
Initialize the scheduler and set the number of threads to use.
unsigned int threads_
The number of threads the scheduler should use.
void setNumberOfThreads(unsigned int nr_threads=0)
Initialize the scheduler and set the number of threads to use.
ParticleFilterTracker tracks the PointCloud which is given by setReferenceCloud within the measured P...
void calcBoundingBox(double &x_min, double &x_max, double &y_min, double &y_max, double &z_min, double &z_max)
Compute the parameters for the bounding box of hypothesis pointclouds.
CloudCoherencePtr coherence_
A pointer to PointCloudCoherence.
typename Coherence::Ptr CoherencePtr
typename PointCloudIn::ConstPtr PointCloudInConstPtr
typename Coherence::ConstPtr CoherenceConstPtr
typename CloudCoherence::Ptr CloudCoherencePtr
bool changed_
A flag to be true when change of pointclouds is detected.
unsigned int change_detector_filter_
Minimum points in a leaf when calling change detector.
pcl::octree::OctreePointCloudChangeDetector< PointInT >::Ptr change_detector_
Change detector used as a trigger to track.
typename PointCloudState::Ptr PointCloudStatePtr
std::vector< PointCloudInPtr > transed_reference_vector_
A list of the pointers to pointclouds.
typename PointCloudState::ConstPtr PointCloudStateConstPtr
unsigned int change_counter_
A counter to skip change detection.
double alpha_
The weight to be used in normalization of the weights of the particles.
bool use_normal_
A flag to use normal or not.
PointCloudStatePtr particles_
A pointer to the particles
unsigned int change_detector_interval_
The number of interval frame to run change detection.
double normalizeParticleWeight(double w, double w_min, double w_max)
Normalize the weight of a particle using .
int particle_num_
The number of the particles.
typename PointCloudIn::Ptr PointCloudInPtr
typename Tracker< PointInT, StateT >::PointCloudState PointCloudState
bool use_change_detector_
The flag which will be true if using change detection.
typename CloudCoherence::ConstPtr CloudCoherenceConstPtr
typename Tracker< PointInT, StateT >::PointCloudIn PointCloudIn
virtual void normalizeWeight()
Normalize the weights of all the particels.
PointCloudCoherence is a base class to compute coherence between the two PointClouds.
Definition: coherence.h:59
shared_ptr< PointCloudCoherence< PointInT > > Ptr
Definition: coherence.h:61
shared_ptr< const PointCloudCoherence< PointInT > > ConstPtr
Definition: coherence.h:62
PointCoherence is a base class to compute coherence between the two points.
Definition: coherence.h:15
shared_ptr< const PointCoherence< PointInT > > ConstPtr
Definition: coherence.h:18
shared_ptr< PointCoherence< PointInT > > Ptr
Definition: coherence.h:17
Tracker represents the base tracker class.
Definition: tracker.h:55
const std::string & getClassName() const
Get a string representation of the name of this class.
Definition: tracker.h:97
SearchPtr search_
A pointer to the spatial search object.
Definition: tracker.h:93
std::string tracker_name_
The tracker name.
Definition: tracker.h:90