![]() |
Visual Servoing Platform version 3.7.0
|
#include <vpHSV.h>
Public Member Functions | |
| vpHSV (const double &H_=0., const double &S_=0., const double &V_=0.) | |
| vpHSV (const vpColVector &v) | |
| vpHSV (const vpHSV< T, useFullScale > &)=default | |
| template<typename U = T, typename V, typename std::enable_if< std::is_same< T, unsigned char >::value &&std::is_floating_point< V >::value &&useFullScale, U >::type = 0> | |
| vpHSV (const vpHSV< V > &other) | |
| template<typename U = T, typename V, typename std::enable_if< std::is_same< T, unsigned char >::value &&std::is_floating_point< V >::value &&!useFullScale, U >::type = 0> | |
| vpHSV (const vpHSV< V > &other) | |
| template<typename U = T, bool otherUseFullScale, typename std::enable_if< std::is_floating_point< U >::value >::type...> | |
| vpHSV (const vpHSV< unsigned char, otherUseFullScale > &other) | |
| vpHSV (const vpRGBa &rgba) | |
| virtual | ~vpHSV ()=default |
| vpHSV< T, useFullScale > & | buildFrom (const vpRGBa &rgba) |
| template<typename V, bool otherUseFullScale> | |
| std::enable_if< std::is_same< T, unsignedchar >::value &&std::is_floating_point< V >::value &&useFullScale, vpHSV< T, useFullScale > & >::type | buildFrom (const vpHSV< V, otherUseFullScale > &other) |
| template<typename U = T, typename V, bool otherUseFullScale> | |
| std::enable_if< std::is_same< U, unsignedchar >::value &&std::is_floating_point< V >::value &&!useFullScale, vpHSV< T, useFullScale > & >::type | buildFrom (const vpHSV< V, otherUseFullScale > &other) |
| template<typename U = T, bool otherUseFullScale> | |
| std::enable_if< std::is_floating_point< U >::value, vpHSV< T, useFullScale > & >::type | buildFrom (const vpHSV< unsigned char, otherUseFullScale > &other) |
| template<typename U = T, typename V, bool otherUseFullScale> | |
| std::enable_if< std::is_floating_point< U >::value &&std::is_floating_point< V >::value &&!std::is_same< T, V >::value, vpHSV< T, useFullScale > & >::type | buildFrom (const vpHSV< V, otherUseFullScale > &other) |
| vpHSV< T, useFullScale > & | operator= (vpHSV< T, useFullScale > &&)=default |
| vpHSV< T, useFullScale > & | operator= (const vpHSV< T, useFullScale > &)=default |
| vpHSV< T, useFullScale > & | operator= (const vpColVector &v) |
| bool | operator== (const vpHSV< T, useFullScale > &v) const |
| bool | operator!= (const vpHSV< T, useFullScale > &v) const |
| vpColVector | operator- (const vpHSV< T, useFullScale > &v) const |
| vpHSV< T, useFullScale > | operator+ (const vpHSV< T, useFullScale > &v) const |
| vpColVector | operator- (const vpColVector &v) const |
| vpColVector | operator+ (const vpColVector &v) const |
| vpColVector | toColVector () const |
| virtual std::string | toString () const |
| VISP_EXPORT vpHSV< unsigned char, false > & | buildFrom (const vpRGBa &rgba) |
| VISP_EXPORT vpHSV< unsigned char, true > & | buildFrom (const vpRGBa &rgba) |
| VISP_EXPORT vpHSV< double > & | buildFrom (const vpRGBa &rgba) |
| BEGIN_VISP_NAMESPACE vpHSV< double > & | buildFrom (const vpRGBa &rgba) |
| vpHSV< unsigned char, true > & | buildFrom (const vpRGBa &rgba) |
| vpHSV< unsigned char, false > & | buildFrom (const vpRGBa &rgba) |
Static Public Member Functions | |
| static vpColVector | computeNormalizedHSV (const vpRGBa &rgba) |
| template<typename ArithmeticType> | |
| static ArithmeticType | squaredMahalanobisDistance (const vpHSV< T, useFullScale > &a, const vpHSV< T, useFullScale > &b, vpColVector &diff) |
| template<typename ArithmeticType> | |
| static ArithmeticType | squaredMahalanobisDistance (const vpHSV< T, useFullScale > &a, const vpHSV< T, useFullScale > &b) |
| template<typename ArithmeticType> | |
| static ArithmeticType | mahalanobisDistance (const vpHSV< T, useFullScale > &a, const vpHSV< T, useFullScale > &b) |
| template<typename ArithmeticType> | |
| static ArithmeticType | mahalanobisDistance (const vpHSV< T, useFullScale > &a, const vpHSV< T, useFullScale > &b, vpColVector &diff) |
Public Attributes | |
| T | H |
| T | S |
| T | V |
Static Public Attributes | |
| static constexpr unsigned char | nbChannels = 3 |
| static constexpr unsigned char | maxHueUsingLimitedRange = 179 |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const vpHSV< T, useFullScale > &hsv) |
Class implementing the HSV pixel format.
| T | The type of the channels. Either a floating point type (float, double) or unsigned char. |
| useFullScale | True if vpHSV uses unsigned char and the full range [0; 255], false if vpHSV uses unsigned char and the limited range [0; maxHueUsingLimitedRange]. |
Tutorials
If you are interested in how you can convert vpHSV to and from other type of data, or how to use it for color segmentation, you may have a look at:
|
inlineexplicit |
Construct a new vpHSV object using floating point channels.
| U | The type of the channels of the vpHSV pixels. |
| [in] | H_ | The value of the Hue channel. |
| [in] | S_ | The value of the Saturation channel. |
| [in] | V_ | The value of the Value channel. |
Definition at line 145 of file vpHSV.h.
Referenced by buildFrom(), buildFrom(), buildFrom(), mahalanobisDistance(), mahalanobisDistance(), operator!=(), operator+(), operator-(), operator<<, operator=(), operator=(), operator=(), operator==(), squaredMahalanobisDistance(), squaredMahalanobisDistance(), vpHSV(), vpHSV(), and vpHSV().
|
inline |
Construct a new vpHSV object from a vpColVector.
| [in] | v | The values must be in the range that corresponds to the type used to encode the channels. |
|
default |
Default copy constructor.
References vpHSV().
|
inline |
Construct a new vpHSV object using unsigned char channels and the full range [0; 255] from a vpHSV object whose channels are in floating point format.
| U | The format of the constructed object. |
| V | The format of the base object. |
| type | Enable the method only if the constructed object uses unsigned char format and uses the full range [0; 255] and the object that is used as reference uses floating point format. |
| [in] | other | A floating point format vpHSV. |
Definition at line 179 of file vpHSV.h.
References buildFrom(), and vpHSV().
|
inline |
Construct a new vpHSV object using unsigned char channels and the limited range [0; maxHueUsingLimitedRange] from a vpHSV object whose channels are in floating point format.
| U | The format of the constructed object. |
| V | The format of the base object. |
| type | Enable the method only if the constructed object uses unsigned char format and uses the limited range [0; maxHueUsingLimitedRange] and the object that is used as reference uses floating point format. |
| [in] | other | A floating point format vpHSV. |
Definition at line 195 of file vpHSV.h.
References buildFrom(), and vpHSV().
|
inline |
Construct a new floating point vpHSV object from an unsigned char vpHSV object.
| U | The type of the channels of the constructed vpHSV pixels. |
| otherUseFullScale | True if the reference object uses unsigned char and the full range [0; 255], false if it uses unsigned char and the limited range [0; maxHueUsingLimitedRange]. |
| type | Enable the method only if the constructed object uses the floating point format for its channels. |
| [in] | other | The reference object. |
Definition at line 210 of file vpHSV.h.
References buildFrom(), and vpHSV().
Default destructor.
|
inline |
Convert a vpHSV that uses unsigned char for its channels into a vpHSV that uses floating point for its channels.
| U | The type of the channels of the vpHSV pixels. |
| otherUseFullScale | |
| type | Enable the method only if the modified object uses floating point format. |
| [in] | other | The unsigned char vpHSV. |
Definition at line 295 of file vpHSV.h.
References H, maxHueUsingLimitedRange, S, V, and vpHSV().
|
inline |
Convert a floating point HSV into another floating point type HSV.
| U | The type of the channels of the vpHSV pixels that is modified. |
| V | The type of the channels of the vpHSV pixels that serves as reference. |
| otherUseFullScale | To avoid problem if one was created with true and the other false (even it is not used for floating point types). |
| type | Enable the method only if the modified object uses is a floating point format, the base object too but the formats are different. The type "int" is not used, it is here only because float and doubles are "not [a] valid type for a template non-type parameter" |
| [in] | other | The floating point HSV. |
|
inline |
Convert a floating point HSV into a unsigned char HSV using the limited range [0; maxHueUsingLimitedRange].
| U | The type of the channels of the vpHSV pixels that is modified. |
| V | The type of the channels of the vpHSV pixels that serves as reference. |
| type | Enable the method only if the modified object uses unsigned char and limited range [0; maxHueUsingLimitedRange] and the base object uses a floating point format. |
| [in] | other | The floating point HSV. |
Definition at line 275 of file vpHSV.h.
References H, maxHueUsingLimitedRange, S, V, and vpHSV().
|
inline |
Convert a floating point HSV into a unsigned char HSV using the full range [0; 255].
| U | The type of the channels of the vpHSV pixels that is modified. |
| V | The type of the channels of the vpHSV pixels that serves as reference. |
| type | Enable the method only if the modified object uses unsigned char and full range [0; 255] and the base object uses a floating point format. |
| [in] | other | The floating point HSV. |
| VISP_EXPORT vpHSV< unsigned char, true > & vpHSV< unsignedchar, true >::buildFrom | ( | const vpRGBa & | rgba | ) |
References vpHSV().
| VISP_EXPORT vpHSV< unsigned char, false > & vpHSV< unsignedchar, false >::buildFrom | ( | const vpRGBa & | rgba | ) |
References vpHSV().
Definition at line 60 of file vpHSV.cpp.
References computeNormalizedHSV(), maxHueUsingLimitedRange, and vpHSV().
Definition at line 48 of file vpHSV.cpp.
References computeNormalizedHSV(), and vpHSV().
| BEGIN_VISP_NAMESPACE vpHSV< double > & vpHSV< double >::buildFrom | ( | const vpRGBa & | rgba | ) |
Definition at line 40 of file vpHSV.cpp.
References computeNormalizedHSV(), and vpHSV().
|
inlinestatic |
Compute the normalized HSV values (i.e. in the range [0; 1]) that correspond to a vpRGBa object.
| [in] | rgba | The RGB pixel. |
Definition at line 337 of file vpHSV.h.
References vpRGBa::B, vpMath::equal(), vpRGBa::G, and vpRGBa::R.
Referenced by buildFrom().
|
inlinestatic |
Compute the Mahalanobis distance between two HSV pixels. It is assumed that the channels are independent and follow a uniform distribution law.
| [in] | a | The first pixel to compare. |
| [in] | b | The second pixel to compare. |
Definition at line 443 of file vpHSV.h.
References squaredMahalanobisDistance(), and vpHSV().
|
inlinestatic |
Compute the Mahalanobis distance between two HSV pixels. It is assumed that the channels are independent and follow a uniform distribution law.
| [in] | a | The first pixel to compare. |
| [in] | b | The second pixel to compare. |
| [out] | diff | The vector (b - a). |
Definition at line 458 of file vpHSV.h.
References squaredMahalanobisDistance(), and vpHSV().
|
inline |
|
inline |
Definition at line 499 of file vpHSV.h.
References toColVector().
|
inline |
Definition at line 485 of file vpHSV.h.
References toColVector(), and vpHSV().
|
inline |
|
default |
References vpHSV().
|
default |
References vpHSV().
|
inlinestatic |
Compute the square of the Mahalanobis distance between two HSV pixels. It is assumed that the channels are independent and follow a uniform distribution law.
| [in] | a | The first pixel to compare. |
| [in] | b | The second pixel to compare. |
Definition at line 428 of file vpHSV.h.
References squaredMahalanobisDistance(), and vpHSV().
|
inlinestatic |
Compute the square of the Mahalanobis distance between two HSV pixels. It is assumed that the channels are independent and follow a uniform distribution law.
| [in] | a | The first pixel to compare. |
| [in] | b | The second pixel to compare. |
| [out] | diff | The vector (b - a). |
Definition at line 407 of file vpHSV.h.
References H, vpColVector::resize(), S, V, and vpHSV().
Referenced by mahalanobisDistance(), mahalanobisDistance(), and squaredMahalanobisDistance().
|
inline |
Cast a vpHSV into a vpColVector.
Definition at line 518 of file vpHSV.h.
Referenced by operator-(), and operator-().
|
virtual |
|
friend |
Definition at line 638 of file vpHSV.h.
References operator<<, toString(), and vpHSV().
Referenced by operator<<.
| T vpHSV< T, useFullScale >::H |
The Hue channel.
Definition at line 537 of file vpHSV.h.
Referenced by buildFrom(), buildFrom(), vpRGBa::buildFrom(), vpColorGetter< ID >::get(), vpColorGetter< ID >::get(), operator+(), operator+(), operator==(), squaredMahalanobisDistance(), toColVector(), toString(), and vpHSV().
|
staticconstexpr |
Maximum value of the Hue channel when using unsigned char and the limited range.
Definition at line 549 of file vpHSV.h.
Referenced by buildFrom(), buildFrom(), and buildFrom().
|
staticconstexpr |
| T vpHSV< T, useFullScale >::S |
The Saturation channel.
Definition at line 538 of file vpHSV.h.
Referenced by buildFrom(), buildFrom(), vpRGBa::buildFrom(), vpColorGetter< ID >::get(), vpColorGetter< ID >::get(), operator+(), operator+(), operator==(), squaredMahalanobisDistance(), toColVector(), toString(), and vpHSV().
| T vpHSV< T, useFullScale >::V |
The Value channel.
Definition at line 539 of file vpHSV.h.
Referenced by buildFrom(), buildFrom(), vpRGBa::buildFrom(), vpColorGetter< ID >::get(), vpColorGetter< ID >::get(), operator+(), operator+(), operator==(), squaredMahalanobisDistance(), toColVector(), toString(), and vpHSV().