coherence.h
#ifndef PCL_TRACKING_COHERENCE_H_
#define PCL_TRACKING_COHERENCE_H_
#include <pcl/pcl_base.h>
namespace pcl
{
namespace tracking
{
/** \brief @b PointCoherence is a base class to compute coherence between the two points.
* \author Ryohei Ueda
* \ingroup tracking
*/
template <typename PointInT>
class PointCoherence
{
public:
typedef boost::shared_ptr< PointCoherence<PointInT> > Ptr;
typedef boost::shared_ptr< const PointCoherence<PointInT> > ConstPtr;
public:
/** \brief empty constructor */
PointCoherence () : coherence_name_ () {}
/** \brief empty distructor */
virtual ~PointCoherence () {}
/** \brief compute coherence from the source point to the target point.
* \param source instance of source point.
* \param target instance of target point.
*/
inline double
compute (PointInT &source, PointInT &target);
protected:
/** \brief The coherence name. */
std::string coherence_name_;
/** \brief abstract method to calculate coherence.
* \param[in] source instance of source point.
* \param[in] target instance of target point.
*/
virtual double
computeCoherence (PointInT &source, PointInT &target) = 0;
/** \brief Get a string representation of the name of this class. */
inline const std::string&
getClassName () const { return (coherence_name_); }
};
/** \brief @b PointCloudCoherence is a base class to compute coherence between the two PointClouds.
* \author Ryohei Ueda
* \ingroup tracking
*/
template <typename PointInT>
class PointCloudCoherence
{
public:
typedef boost::shared_ptr< PointCloudCoherence<PointInT> > Ptr;
typedef boost::shared_ptr< const PointCloudCoherence<PointInT> > ConstPtr;
typedef pcl::PointCloud<PointInT> PointCloudIn;
typedef typename PointCloudIn::Ptr PointCloudInPtr;
typedef typename PointCloudIn::ConstPtr PointCloudInConstPtr;
typedef typename PointCoherence<PointInT>::Ptr PointCoherencePtr;
/** \brief Constructor. */
PointCloudCoherence () : coherence_name_ (), target_input_ (), point_coherences_ () {}
/** \brief Destructor. */
virtual ~PointCloudCoherence () {}
/** \brief compute coherence between two pointclouds. */
inline void
compute (const PointCloudInConstPtr &cloud, const IndicesConstPtr &indices,
float &w_i);
/** \brief get a list of pcl::tracking::PointCoherence.*/
inline std::vector<PointCoherencePtr>
getPointCoherences () { return point_coherences_; }
/** \brief set a list of pcl::tracking::PointCoherence.
* \param coherences a list of pcl::tracking::PointCoherence.
*/
inline void
setPointCoherences (std::vector<PointCoherencePtr> coherences) { point_coherences_ = coherences; }
/** \brief This method should get called before starting the actual computation. */
virtual bool initCompute ();
/** \brief add a PointCoherence to the PointCloudCoherence.
* \param coherence a pointer to PointCoherence.
*/
inline void
addPointCoherence (PointCoherencePtr coherence) { point_coherences_.push_back (coherence); }
/** \brief add a PointCoherence to the PointCloudCoherence.
* \param cloud a pointer to PointCoherence.
*/
virtual inline void
setTargetCloud (const PointCloudInConstPtr &cloud) { target_input_ = cloud; }
protected:
/** \brief Abstract method to compute coherence. */
virtual void
computeCoherence (const PointCloudInConstPtr &cloud, const IndicesConstPtr &indices, float &w_j) = 0;
inline double calcPointCoherence (PointInT &source, PointInT &target);
/** \brief Get a string representation of the name of this class. */
inline const std::string&
getClassName () const { return (coherence_name_); }
/** \brief The coherence name. */
std::string coherence_name_;
/** \brief a pointer to target point cloud*/
PointCloudInConstPtr target_input_;
/** \brief a list of pointers to PointCoherence.*/
std::vector<PointCoherencePtr> point_coherences_;
};
}
}
#include <pcl/tracking/impl/coherence.hpp>
#endif
pcl::tracking::PointCloudCoherence::PointCloudCoherence
PointCloudCoherence()
Constructor.
Definition: coherence.h:72
pcl::tracking::PointCoherence::compute
double compute(PointInT &source, PointInT &target)
compute coherence from the source point to the target point.
Definition: coherence.hpp:13
pcl
Definition: cloud_iterator.h:46
pcl::tracking::PointCloudCoherence::PointCoherencePtr
PointCoherence< PointInT >::Ptr PointCoherencePtr
Definition: coherence.h:70
pcl::tracking::PointCloudCoherence::PointCloudInPtr
PointCloudIn::Ptr PointCloudInPtr
Definition: coherence.h:67
pcl::tracking::PointCloudCoherence::target_input_
PointCloudInConstPtr target_input_
a pointer to target point cloud
Definition: coherence.h:123
pcl::tracking::PointCoherence::computeCoherence
virtual double computeCoherence(PointInT &source, PointInT &target)=0
abstract method to calculate coherence.
pcl::tracking::PointCoherence::Ptr
boost::shared_ptr< PointCoherence< PointInT > > Ptr
Definition: coherence.h:20
pcl::tracking::PointCoherence::getClassName
const std::string & getClassName() const
Get a string representation of the name of this class.
Definition: coherence.h:51
pcl::tracking::PointCloudCoherence::PointCloudIn
pcl::PointCloud< PointInT > PointCloudIn
Definition: coherence.h:66
pcl::tracking::PointCoherence::ConstPtr
boost::shared_ptr< const PointCoherence< PointInT > > ConstPtr
Definition: coherence.h:21
pcl::tracking::PointCloudCoherence::coherence_name_
std::string coherence_name_
The coherence name.
Definition: coherence.h:120
pcl::PointCloud< PointInT >::Ptr
boost::shared_ptr< PointCloud< PointInT > > Ptr
Definition: point_cloud.h:428
pcl::tracking::PointCloudCoherence::getPointCoherences
std::vector< PointCoherencePtr > getPointCoherences()
get a list of pcl::tracking::PointCoherence.
Definition: coherence.h:84
pcl::tracking::PointCloudCoherence::ConstPtr
boost::shared_ptr< const PointCloudCoherence< PointInT > > ConstPtr
Definition: coherence.h:64
pcl::tracking::PointCloudCoherence::addPointCoherence
void addPointCoherence(PointCoherencePtr coherence)
add a PointCoherence to the PointCloudCoherence.
Definition: coherence.h:99
pcl::tracking::PointCoherence::PointCoherence
PointCoherence()
empty constructor
Definition: coherence.h:25
pcl::tracking::PointCoherence
PointCoherence is a base class to compute coherence between the two points.
Definition: coherence.h:17
pcl::tracking::PointCloudCoherence::setPointCoherences
void setPointCoherences(std::vector< PointCoherencePtr > coherences)
set a list of pcl::tracking::PointCoherence.
Definition: coherence.h:90
pcl::PointCloud< PointInT >::ConstPtr
boost::shared_ptr< const PointCloud< PointInT > > ConstPtr
Definition: point_cloud.h:429
pcl::tracking::PointCloudCoherence::~PointCloudCoherence
virtual ~PointCloudCoherence()
Destructor.
Definition: coherence.h:75
pcl::PointCloud< PointInT >
pcl::tracking::PointCloudCoherence::point_coherences_
std::vector< PointCoherencePtr > point_coherences_
a list of pointers to PointCoherence.
Definition: coherence.h:126
pcl::tracking::PointCloudCoherence
PointCloudCoherence is a base class to compute coherence between the two PointClouds.
Definition: coherence.h:60
pcl::IndicesConstPtr
boost::shared_ptr< const std::vector< int > > IndicesConstPtr
Definition: pcl_base.h:61
pcl::tracking::PointCloudCoherence::setTargetCloud
virtual void setTargetCloud(const PointCloudInConstPtr &cloud)
add a PointCoherence to the PointCloudCoherence.
Definition: coherence.h:105
pcl::tracking::PointCloudCoherence::Ptr
boost::shared_ptr< PointCloudCoherence< PointInT > > Ptr
Definition: coherence.h:63
pcl::tracking::PointCoherence::coherence_name_
std::string coherence_name_
The coherence name.
Definition: coherence.h:40
pcl::tracking::PointCloudCoherence::getClassName
const std::string & getClassName() const
Get a string representation of the name of this class.
Definition: coherence.h:116
pcl::tracking::PointCoherence::~PointCoherence
virtual ~PointCoherence()
empty distructor
Definition: coherence.h:28
pcl::tracking::PointCloudCoherence::PointCloudInConstPtr
PointCloudIn::ConstPtr PointCloudInConstPtr
Definition: coherence.h:68