Point Cloud Library (PCL)
1.7.0
|
00001 #ifndef PCL_TRACKING_HSV_COLOR_COHERENCE_H_ 00002 #define PCL_TRACKING_HSV_COLOR_COHERENCE_H_ 00003 00004 #include <pcl/tracking/coherence.h> 00005 00006 namespace pcl 00007 { 00008 namespace tracking 00009 { 00010 /** \brief @b HSVColorCoherence computes coherence between the two points from 00011 the color difference between them. the color difference is calculated in HSV color space. 00012 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)) 00013 * \author Ryohei Ueda 00014 * \ingroup tracking 00015 */ 00016 template <typename PointInT> 00017 class HSVColorCoherence: public PointCoherence<PointInT> 00018 { 00019 public: 00020 00021 /** \brief initialize the weights of the computation. 00022 weight_, h_weight_, s_weight_ default to 1.0 and 00023 v_weight_ defaults to 0.0. 00024 */ 00025 HSVColorCoherence () 00026 : PointCoherence<PointInT> () 00027 , weight_ (1.0) 00028 , h_weight_ (1.0) 00029 , s_weight_ (1.0) 00030 , v_weight_ (0.0) 00031 {} 00032 00033 /** \brief set the weight of coherence 00034 * \param[in] weight the weight of coherence. 00035 */ 00036 inline void 00037 setWeight (double weight) { weight_ = weight; } 00038 00039 /** \brief get the weight (w) of coherence */ 00040 inline double 00041 getWeight () { return weight_; } 00042 00043 /** \brief set the hue weight (w_h) of coherence 00044 * \param[in] weight the hue weight (w_h) of coherence. 00045 */ 00046 inline void 00047 setHWeight (double weight) { h_weight_ = weight; } 00048 00049 /** \brief get the hue weight (w_h) of coherence */ 00050 inline double 00051 getHWeight () { return h_weight_; } 00052 00053 /** \brief set the saturation weight (w_s) of coherence 00054 * \param[in] weight the saturation weight (w_s) of coherence. 00055 */ 00056 inline void 00057 setSWeight (double weight) { s_weight_ = weight; } 00058 00059 /** \brief get the saturation weight (w_s) of coherence */ 00060 inline double 00061 getSWeight () { return s_weight_; } 00062 00063 /** \brief set the value weight (w_v) of coherence 00064 * \param[in] weight the value weight (w_v) of coherence. 00065 */ 00066 inline void 00067 setVWeight (double weight) { v_weight_ = weight; } 00068 00069 /** \brief get the value weight (w_v) of coherence */ 00070 inline double 00071 getVWeight () { return v_weight_; } 00072 00073 protected: 00074 00075 /** \brief return the color coherence between the two points. 00076 * \param[in] source instance of source point. 00077 * \param[in] target instance of target point. 00078 */ 00079 double 00080 computeCoherence (PointInT &source, PointInT &target); 00081 00082 /** \brief the weight of coherence (w) */ 00083 double weight_; 00084 00085 /** \brief the hue weight (w_h) */ 00086 double h_weight_; 00087 00088 /** \brief the saturation weight (w_s) */ 00089 double s_weight_; 00090 00091 /** \brief the value weight (w_v) */ 00092 double v_weight_; 00093 00094 }; 00095 } 00096 } 00097 00098 // #include <pcl/tracking/impl/hsv_color_coherence.hpp> 00099 00100 #ifdef PCL_NO_PRECOMPILE 00101 #include <pcl/tracking/impl/hsv_color_coherence.hpp> 00102 #endif 00103 00104 #endif