Point Cloud Library (PCL)
1.7.0
Main Page
Modules
Namespaces
Classes
tracking
include
pcl
tracking
hsv_color_coherence.h
1
#ifndef PCL_TRACKING_HSV_COLOR_COHERENCE_H_
2
#define PCL_TRACKING_HSV_COLOR_COHERENCE_H_
3
4
#include <pcl/tracking/coherence.h>
5
6
namespace
pcl
7
{
8
namespace
tracking
9
{
10
/** \brief @b HSVColorCoherence computes coherence between the two points from
11
the color difference between them. the color difference is calculated in HSV color space.
12
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))
13
* \author Ryohei Ueda
14
* \ingroup tracking
15
*/
16
template
<
typename
Po
int
InT>
17
class
HSVColorCoherence
:
public
PointCoherence
<PointInT>
18
{
19
public
:
20
21
/** \brief initialize the weights of the computation.
22
weight_, h_weight_, s_weight_ default to 1.0 and
23
v_weight_ defaults to 0.0.
24
*/
25
HSVColorCoherence
()
26
:
PointCoherence
<PointInT> ()
27
,
weight_
(1.0)
28
,
h_weight_
(1.0)
29
,
s_weight_
(1.0)
30
,
v_weight_
(0.0)
31
{}
32
33
/** \brief set the weight of coherence
34
* \param[in] weight the weight of coherence.
35
*/
36
inline
void
37
setWeight
(
double
weight) {
weight_
= weight; }
38
39
/** \brief get the weight (w) of coherence */
40
inline
double
41
getWeight
() {
return
weight_
; }
42
43
/** \brief set the hue weight (w_h) of coherence
44
* \param[in] weight the hue weight (w_h) of coherence.
45
*/
46
inline
void
47
setHWeight
(
double
weight) {
h_weight_
= weight; }
48
49
/** \brief get the hue weight (w_h) of coherence */
50
inline
double
51
getHWeight
() {
return
h_weight_
; }
52
53
/** \brief set the saturation weight (w_s) of coherence
54
* \param[in] weight the saturation weight (w_s) of coherence.
55
*/
56
inline
void
57
setSWeight
(
double
weight) {
s_weight_
= weight; }
58
59
/** \brief get the saturation weight (w_s) of coherence */
60
inline
double
61
getSWeight
() {
return
s_weight_
; }
62
63
/** \brief set the value weight (w_v) of coherence
64
* \param[in] weight the value weight (w_v) of coherence.
65
*/
66
inline
void
67
setVWeight
(
double
weight) {
v_weight_
= weight; }
68
69
/** \brief get the value weight (w_v) of coherence */
70
inline
double
71
getVWeight
() {
return
v_weight_
; }
72
73
protected
:
74
75
/** \brief return the color coherence between the two points.
76
* \param[in] source instance of source point.
77
* \param[in] target instance of target point.
78
*/
79
double
80
computeCoherence
(PointInT &source, PointInT &target);
81
82
/** \brief the weight of coherence (w) */
83
double
weight_
;
84
85
/** \brief the hue weight (w_h) */
86
double
h_weight_
;
87
88
/** \brief the saturation weight (w_s) */
89
double
s_weight_
;
90
91
/** \brief the value weight (w_v) */
92
double
v_weight_
;
93
94
};
95
}
96
}
97
98
// #include <pcl/tracking/impl/hsv_color_coherence.hpp>
99
100
#ifdef PCL_NO_PRECOMPILE
101
#include <pcl/tracking/impl/hsv_color_coherence.hpp>
102
#endif
103
104
#endif