Point Cloud Library (PCL)  1.9.1-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/tracking/tracking.h>
43 #include <pcl/pcl_base.h>
44 #include <pcl/pcl_macros.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  using Ptr = boost::shared_ptr< Tracker<PointInT, StateT> >;
67  using ConstPtr = boost::shared_ptr< const Tracker<PointInT, StateT> >;
68 
69  using SearchPtr = boost::shared_ptr<pcl::search::Search<PointInT> >;
70  using SearchConstPtr = boost::shared_ptr<const pcl::search::Search<PointInT> >;
71 
75 
79 
80  public:
81  /** \brief Empty constructor. */
82  Tracker (): search_ () {}
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 search 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:
130  };
131  }
132 }
133 
134 #include <pcl/tracking/impl/tracker.hpp>
boost::shared_ptr< Tracker< PointInT, Eigen::Affine3f > > Ptr
Definition: tracker.h:66
typename PointCloudIn::ConstPtr PointCloudInConstPtr
Definition: tracker.h:74
typename PointCloudIn::Ptr PointCloudInPtr
Definition: tracker.h:73
This file defines compatibility wrappers for low level I/O functions.
Definition: convolution.h:45
#define PCL_MAKE_ALIGNED_OPERATOR_NEW
Macro to signal a class requires a custom allocator.
Definition: pcl_macros.h:344
Tracker()
Empty constructor.
Definition: tracker.h:82
typename PointCloudState::ConstPtr PointCloudStateConstPtr
Definition: tracker.h:78
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:113
virtual bool initCompute()
This method should get called before starting the actual computation.
Definition: tracker.hpp:9
virtual StateT getResult() const =0
Get an instance of the result of tracking.
SearchPtr search_
A pointer to the spatial search object.
Definition: tracker.h:95
PCL base class.
Definition: pcl_base.h:69
boost::shared_ptr< PointCloud< PointInT > > Ptr
Definition: point_cloud.h:441
void compute()
Base method for tracking for all points given in <setInputCloud (), setIndices ()> using the indices ...
Definition: tracker.hpp:30
boost::shared_ptr< pcl::search::Search< PointInT > > SearchPtr
Definition: tracker.h:69
boost::shared_ptr< const pcl::search::Search< PointInT > > SearchConstPtr
Definition: tracker.h:70
boost::shared_ptr< const PointCloud< PointInT > > ConstPtr
Definition: point_cloud.h:442
boost::shared_ptr< const Tracker< PointInT, Eigen::Affine3f > > ConstPtr
Definition: tracker.h:67
Tracker represents the base tracker class.
Definition: tracker.h:56
SearchPtr getSearchMethod()
Get a pointer to the point cloud dataset.
Definition: tracker.h:117
const std::string & getClassName() const
Get a string representation of the name of this class.
Definition: tracker.h:99
typename PointCloudState::Ptr PointCloudStatePtr
Definition: tracker.h:77
Defines all the PCL and non-PCL macros used.
std::string tracker_name_
The tracker name.
Definition: tracker.h:92