KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
i_hsv.h
Go to the documentation of this file.
1 
6 /*
7  * $Id: i_hsv.h 18170 2014-11-10 23:22:06Z ksimek $
8  */
9 
10 #ifndef KJB_I_CPP_HSV_H
11 #define KJB_I_CPP_HSV_H
12 
13 #include <i/i_float.h>
14 #include <i/i_float_io.h>
15 #include <i_cpp/i_pixel.h>
16 
17 #include <algorithm> /* for min and max */
18 
19 namespace kjb
20 {
21 
22 // Forward declaration
23 class Vector;
24 
59 struct PixelHSVA : public kjb_c::Pixel
60 {
66  : kjb_c::Pixel()
67  {
68  }
69 
76  PixelHSVA(const kjb_c::Pixel& p)
77  {
78  r = p.r;
79  g = p.g;
80  b = p.b;
81  extra.alpha = p.extra.alpha;
82  }
83 
95  PixelHSVA( float hh, float ss, float vv, float aa = 1.0f );
96 
97 
99  void get_hsv( float*, float*, float* ) const;
100 
101 
103  float get_hue() const
104  {
105  float hue;
106  get_hsv( &hue, 0, 0 );
107  return hue;
108  }
109 
111  float get_saturation() const
112  {
113  float saturation;
114  get_hsv( 0, &saturation, 0 );
115  return saturation;
116  }
117 
119  float get_value() const
120  {
121  float value;
122  get_hsv( 0, 0, &value );
123  return value;
124  }
125 
126 
127 };
128 
129 
130 
168 Vector hsluma_space( const kjb_c::Pixel& p );
169 
170 
185 kjb_c::Pixel get_pixel_from_hsluma_space( const Vector& hsy );
186 
187 
210 int get_pixel_from_hsluma_space( const Vector& hsy, kjb_c::Pixel* p );
211 
212 
214 
215 } //namespace kjb
216 
217 #endif
Alternative Pixel using hue, saturation, value, and opacity (alpha).
Definition: i_hsv.h:59
float get_hue() const
get hue (in range 0-1) but please consider using get_hsv().
Definition: i_hsv.h:103
r
Definition: APPgetLargeConnectedEdges.m:127
float get_value() const
get value (in range 0-1) but please consider using get_hsv().
Definition: i_hsv.h:119
function straight edges straight lines(nlines,[x1 x2 y1 y2 theta r])%%To display result ss
Definition: APPgetLargeConnectedEdges.m:20
Vector hsluma_space(const kjb_c::Pixel &p)
Compute the spatial coordinates of a pixel in HSY color space.
Definition: i_hsv.cpp:172
float get_saturation() const
get saturation (in range 0-1) but please consider get_hsv().
Definition: i_hsv.h:111
PixelHSVA(const kjb_c::Pixel &p)
This builds a valid pixel from another.
Definition: i_hsv.h:76
Code for a wrapper class around the C struct Pixel.
PixelHSVA()
Default ctor, which leaves all fields uninitialized.
Definition: i_hsv.h:65
kjb_c::Pixel get_pixel_from_hsluma_space(const Vector &vhsy)
This clampfully transforms a point in HSY space to RGB.
Definition: i_hsv.cpp:200
void get_hsv(float *, float *, float *) const
get hue, saturation, value (each in range 0-1 if 0<=r,g,b<=255).
Definition: i_hsv.cpp:133