Point Cloud Library (PCL)  1.7.1
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 #ifndef PCL_TRACKING_TRACKER_H_
41 #define PCL_TRACKING_TRACKER_H_
42 
43 #include <pcl/tracking/tracking.h>
44 #include <pcl/pcl_base.h>
45 #include <pcl/search/search.h>
46 
47 namespace pcl
48 {
49  namespace tracking
50  {
51  /** \brief @b Tracker represents the base tracker class.
52  * \author Ryohei Ueda
53  * \ingroup tracking
54  */
55  template <typename PointInT, typename StateT>
56  class Tracker: public PCLBase<PointInT>
57  {
58  protected:
60 
61  public:
64 
66  typedef boost::shared_ptr< Tracker<PointInT, StateT> > Ptr;
67  typedef boost::shared_ptr< const Tracker<PointInT, StateT> > ConstPtr;
68 
69  typedef boost::shared_ptr<pcl::search::Search<PointInT> > SearchPtr;
70  typedef boost::shared_ptr<const pcl::search::Search<PointInT> > SearchConstPtr;
71 
75 
79 
80  public:
81  /** \brief Empty constructor. */
83 
84  /** \brief Base method for tracking for all points given in
85  * <setInputCloud (), setIndices ()> using the indices in setIndices ()
86  */
87  void
88  compute ();
89 
90  protected:
91  /** \brief The tracker name. */
92  std::string tracker_name_;
93 
94  /** \brief A pointer to the spatial search object. */
96 
97  /** \brief Get a string representation of the name of this class. */
98  inline const std::string&
99  getClassName () const { return (tracker_name_); }
100 
101  /** \brief This method should get called before starting the actual computation. */
102  virtual bool
103  initCompute ();
104 
105  /** \brief Provide a pointer to a dataset to add additional information
106  * to estimate the features for every point in the input dataset. This
107  * is optional, if this is not set, it will only use the data in the
108  * input cloud to estimate the features. This is useful when you only
109  * need to compute the features for a downsampled cloud.
110  * \param cloud a pointer to a PointCloud message
111  */
112  inline void
113  setSearchMethod (const SearchPtr &search) { search_ = search; }
114 
115  /** \brief Get a pointer to the point cloud dataset. */
116  inline SearchPtr
117  getSearchMethod () { return (search_); }
118 
119  /** \brief Get an instance of the result of tracking. */
120  virtual StateT
121  getResult () const = 0;
122 
123  private:
124  /** \brief Abstract tracking method. */
125  virtual void
126  computeTracking () = 0;
127 
128  public:
129  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
130  };
131  }
132 }
133 
134 #include <pcl/tracking/impl/tracker.hpp>
135 
136 #endif