Loading...
Searching...
No Matches
hsv_color_coherence.h
#pragma once
#include <pcl/tracking/coherence.h>
namespace pcl {
namespace tracking {
/** \brief @b HSVColorCoherence computes coherence between the two points from the color
* difference between them. the color difference is calculated in HSV color space. the
* coherence is calculated by 1 / ( 1 + w * (w_h^2 * h_diff^2 + w_s^2 * s_diff^2 + w_v^2
* * v_diff^2))
* \author Ryohei Ueda
* \ingroup tracking
*/
template <typename PointInT>
class HSVColorCoherence : public PointCoherence<PointInT> {
public:
using Ptr = shared_ptr<HSVColorCoherence<PointInT>>;
using ConstPtr = shared_ptr<const HSVColorCoherence<PointInT>>;
/** \brief initialize the weights of the computation. weight_, h_weight_, s_weight_
* default to 1.0 and v_weight_ defaults to 0.0.
*/
HSVColorCoherence()
: PointCoherence<PointInT>()
, weight_(1.0)
, h_weight_(1.0)
, s_weight_(1.0)
, v_weight_(0.0)
{}
/** \brief set the weight of coherence
* \param[in] weight the weight of coherence.
*/
inline void
setWeight(double weight)
{
weight_ = weight;
}
/** \brief get the weight (w) of coherence */
inline double
getWeight()
{
return weight_;
}
/** \brief set the hue weight (w_h) of coherence
* \param[in] weight the hue weight (w_h) of coherence.
*/
inline void
setHWeight(double weight)
{
h_weight_ = weight;
}
/** \brief get the hue weight (w_h) of coherence */
inline double
getHWeight()
{
return h_weight_;
}
/** \brief set the saturation weight (w_s) of coherence
* \param[in] weight the saturation weight (w_s) of coherence.
*/
inline void
setSWeight(double weight)
{
s_weight_ = weight;
}
/** \brief get the saturation weight (w_s) of coherence */
inline double
getSWeight()
{
return s_weight_;
}
/** \brief set the value weight (w_v) of coherence
* \param[in] weight the value weight (w_v) of coherence.
*/
inline void
setVWeight(double weight)
{
v_weight_ = weight;
}
/** \brief get the value weight (w_v) of coherence */
inline double
getVWeight()
{
return v_weight_;
}
protected:
/** \brief return the color coherence between the two points.
* \param[in] source instance of source point.
* \param[in] target instance of target point.
*/
double
computeCoherence(PointInT& source, PointInT& target) override;
/** \brief the weight of coherence (w) */
double weight_;
/** \brief the hue weight (w_h) */
double h_weight_;
/** \brief the saturation weight (w_s) */
double s_weight_;
/** \brief the value weight (w_v) */
double v_weight_;
};
} // namespace tracking
} // namespace pcl
#ifdef PCL_NO_PRECOMPILE
#include <pcl/tracking/impl/hsv_color_coherence.hpp>
#endif
pcl::tracking::HSVColorCoherence::setWeight
void setWeight(double weight)
set the weight of coherence
Definition hsv_color_coherence.h:35
pcl::tracking::HSVColorCoherence::HSVColorCoherence
HSVColorCoherence()
initialize the weights of the computation.
Definition hsv_color_coherence.h:23
pcl::tracking::HSVColorCoherence::setHWeight
void setHWeight(double weight)
set the hue weight (w_h) of coherence
Definition hsv_color_coherence.h:51
pcl::tracking::HSVColorCoherence::setSWeight
void setSWeight(double weight)
set the saturation weight (w_s) of coherence
Definition hsv_color_coherence.h:67
pcl::tracking::HSVColorCoherence::getWeight
double getWeight()
get the weight (w) of coherence
Definition hsv_color_coherence.h:42
pcl::tracking::HSVColorCoherence::getSWeight
double getSWeight()
get the saturation weight (w_s) of coherence
Definition hsv_color_coherence.h:74
pcl::tracking::HSVColorCoherence::computeCoherence
double computeCoherence(PointInT &source, PointInT &target) override
return the color coherence between the two points.
Definition hsv_color_coherence.hpp:132
pcl::tracking::HSVColorCoherence::h_weight_
double h_weight_
the hue weight (w_h)
Definition hsv_color_coherence.h:107
pcl::tracking::HSVColorCoherence::weight_
double weight_
the weight of coherence (w)
Definition hsv_color_coherence.h:104
pcl::tracking::HSVColorCoherence::ConstPtr
shared_ptr< const HSVColorCoherence< PointInT > > ConstPtr
Definition hsv_color_coherence.h:18
pcl::tracking::HSVColorCoherence::s_weight_
double s_weight_
the saturation weight (w_s)
Definition hsv_color_coherence.h:110
pcl::tracking::HSVColorCoherence::getVWeight
double getVWeight()
get the value weight (w_v) of coherence
Definition hsv_color_coherence.h:90
pcl::tracking::HSVColorCoherence::v_weight_
double v_weight_
the value weight (w_v)
Definition hsv_color_coherence.h:113
pcl::tracking::HSVColorCoherence::setVWeight
void setVWeight(double weight)
set the value weight (w_v) of coherence
Definition hsv_color_coherence.h:83
pcl::tracking::HSVColorCoherence::getHWeight
double getHWeight()
get the hue weight (w_h) of coherence
Definition hsv_color_coherence.h:58
pcl::tracking::HSVColorCoherence::Ptr
shared_ptr< HSVColorCoherence< PointInT > > Ptr
Definition hsv_color_coherence.h:17
pcl::tracking::PointCoherence::PointCoherence
PointCoherence()=default
empty constructor
pcl::tracking
Definition approx_nearest_pair_point_cloud_coherence.h:7
pcl
Definition convolution.h:46