Point Cloud Library (PCL)  1.14.0-dev
tracker.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2010-2012, Willow Garage, Inc.
6  *
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * * Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  * * Redistributions in binary form must reproduce the above
16  * copyright notice, this list of conditions and the following
17  * disclaimer in the documentation and/or other materials provided
18  * with the distribution.
19  * * Neither the name of Willow Garage, Inc. nor the names of its
20  * contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  *
36  * $Id: point_cloud.h 4696 2012-02-23 06:12:55Z rusu $
37  *
38  */
39 
40 #pragma once
41 
42 #include <pcl/search/search.h>
43 #include <pcl/tracking/tracking.h>
44 #include <pcl/memory.h>
45 #include <pcl/pcl_base.h>
46 #include <pcl/pcl_macros.h>
47 
48 namespace pcl {
49 namespace tracking {
50 /** \brief @b Tracker represents the base tracker class.
51  * \author Ryohei Ueda
52  * \ingroup tracking
53  */
54 template <typename PointInT, typename StateT>
55 class Tracker : public PCLBase<PointInT> {
56 protected:
58 
59 public:
62 
64  using Ptr = shared_ptr<Tracker<PointInT, StateT>>;
65  using ConstPtr = shared_ptr<const Tracker<PointInT, StateT>>;
66 
69 
73 
77 
78 public:
79  /** \brief Empty constructor. */
80  Tracker() : search_() {}
81 
82  /** \brief Base method for tracking for all points given in
83  * <setInputCloud (), setIndices ()> using the indices in setIndices ()
84  */
85  void
86  compute();
87 
88 protected:
89  /** \brief The tracker name. */
90  std::string tracker_name_;
91 
92  /** \brief A pointer to the spatial search object. */
94 
95  /** \brief Get a string representation of the name of this class. */
96  inline const std::string&
97  getClassName() const
98  {
99  return (tracker_name_);
100  }
101 
102  /** \brief This method should get called before starting the actual
103  * computation. */
104  virtual bool
105  initCompute();
106 
107  /** \brief Provide a pointer to a dataset to add additional information
108  * to estimate the features for every point in the input dataset. This
109  * is optional, if this is not set, it will only use the data in the
110  * input cloud to estimate the features. This is useful when you only
111  * need to compute the features for a downsampled cloud.
112  * \param search a pointer to a PointCloud message
113  */
114  inline void
115  setSearchMethod(const SearchPtr& search)
116  {
117  search_ = search;
118  }
119 
120  /** \brief Get a pointer to the point cloud dataset. */
121  inline SearchPtr
123  {
124  return (search_);
125  }
126 
127  /** \brief Get an instance of the result of tracking. */
128  virtual StateT
129  getResult() const = 0;
130 
131 private:
132  /** \brief Abstract tracking method. */
133  virtual void
134  computeTracking() = 0;
135 
136 public:
138 };
139 } // namespace tracking
140 } // namespace pcl
141 
142 #include <pcl/tracking/impl/tracker.hpp>
PCL base class.
Definition: pcl_base.h:70
shared_ptr< PointCloud< PointInT > > Ptr
Definition: point_cloud.h:413
shared_ptr< const PointCloud< PointInT > > ConstPtr
Definition: point_cloud.h:414
shared_ptr< const pcl::search::Search< PointT > > ConstPtr
Definition: search.h:82
shared_ptr< pcl::search::Search< PointT > > Ptr
Definition: search.h:81
Tracker represents the base tracker class.
Definition: tracker.h:55
shared_ptr< const Tracker< PointInT, StateT > > ConstPtr
Definition: tracker.h:65
void compute()
Base method for tracking for all points given in <setInputCloud (), setIndices ()> using the indices ...
Definition: tracker.hpp:30
SearchPtr search_
A pointer to the spatial search object.
Definition: tracker.h:93
void setSearchMethod(const SearchPtr &search)
Provide a pointer to a dataset to add additional information to estimate the features for every point...
Definition: tracker.h:115
const std::string & getClassName() const
Get a string representation of the name of this class.
Definition: tracker.h:97
typename PointCloudState::ConstPtr PointCloudStateConstPtr
Definition: tracker.h:76
SearchPtr getSearchMethod()
Get a pointer to the point cloud dataset.
Definition: tracker.h:122
virtual StateT getResult() const =0
Get an instance of the result of tracking.
typename pcl::search::Search< PointInT >::ConstPtr SearchConstPtr
Definition: tracker.h:68
std::string tracker_name_
The tracker name.
Definition: tracker.h:90
shared_ptr< Tracker< PointInT, StateT > > Ptr
Definition: tracker.h:64
Tracker()
Empty constructor.
Definition: tracker.h:80
typename PointCloudIn::Ptr PointCloudInPtr
Definition: tracker.h:71
typename PointCloudIn::ConstPtr PointCloudInConstPtr
Definition: tracker.h:72
typename PointCloudState::Ptr PointCloudStatePtr
Definition: tracker.h:75
typename pcl::search::Search< PointInT >::Ptr SearchPtr
Definition: tracker.h:67
virtual bool initCompute()
This method should get called before starting the actual computation.
Definition: tracker.hpp:10
#define PCL_MAKE_ALIGNED_OPERATOR_NEW
Macro to signal a class requires a custom allocator.
Definition: memory.h:63
Defines functions, macros and traits for allocating and using memory.
Defines all the PCL and non-PCL macros used.