1 #ifndef colors_YUV_Space_H__
2 #define colors_YUV_Space_H__
5 #include "../geo/Vectors.h"
8 #include "../math/utility.h"
40 double const&
yuvMin(
size_t i)
const {
return min(i); }
41 double const&
yMin( )
const {
return min(0); }
42 double const&
uMin( )
const {
return min(1); }
43 double const&
vMin( )
const {
return min(2); }
44 double const&
yuvMax(
size_t i)
const {
return max(i); }
45 double const&
yMax( )
const {
return max(0); }
46 double const&
uMax( )
const {
return max(1); }
47 double const&
vMax( )
const {
return max(2); }
48 double const&
yuv(
size_t i)
const {
return val(i); }
49 double const&
y( )
const {
return yuv(0); }
50 double const&
u( )
const {
return yuv(1); }
51 double const&
v( )
const {
return yuv(2); }
52 double const&
yuv(
size_t i,
double c) {
return val(i, c); }
53 double const&
y(
double c) {
return yuv(0, c); }
54 double const&
u(
double c) {
return yuv(1, c); }
55 double const&
v(
double c) {
return yuv(2, c); }
88 double y = 0.299 * r + 0.587 * g + 0.114 * b;
89 double u = -0.169 * r - 0.331 * g + 0.500 * b + 0.5;
90 double v = 0.500 * r - 0.419 * g - 0.081 * b + 0.5;
103 double r = y - 0.00093 * (u - 0.5) + 1.401687 * (v - 0.5);
104 double g = y - 0.34370 * (u - 0.5) - 0.714170 * (v - 0.5);
105 double b = y + 1.77216 * (u - 0.5) - 0.000990 * (v - 0.5);
131 #endif // colors_YUV_H__
double const & yMax() const
T normalize(T lower, T upper, T value)
(value-lower)/(upper-lower)
double const & rMin() const
void colorTransformate(RGBf_Space const &rgb, HSLf_Space *hsl)
RGBf_Space to HSLf_Space
YUVf_Space(YUV_Space const &b)
以浮點數Red, Green, Blue 三個值所組成的色彩空間
doubleconst & min(size_t id) const
Return the minimum of the i -th channel.
double const & yuv(size_t i, double c)
double const & v(double c)
double & yuvGet(size_t i)
YUVf_Space & operator=(YUVf_Space const &b)
double const & u(double c)
double & valGet(size_t id)
Get the non-constant reference of value of the i -th channel.
double const & uMin() const
double operator*(YUVf_Space const &b) const
T denormalize(T lower, T upper, T _ratio)
(lower+_ratio*(upper-lower))
doubleconst & max(size_t id) const
Return the maximum of the i -th channel.
double const & yMin() const
以浮點數Y(亮度), U(色度), V(濃度) 三個值所組成的色彩空間
Base class of color space with 3 channels.
double const & yuvMin(size_t i) const
YUVf_Space operator/(double const &c) const
double const & gMin() const
以整數 Red, Green, Blue 三個值所組成的色彩空間
double const & bMax() const
double const & rMax() const
YUVf_Space(Vector3D< double > const &v)
YUVf_Space operator+(YUVf_Space const &b) const
double const & gMax() const
YUVf_Space operator*(double const &c) const
double const & bMin() const
double const & yuv(size_t i) const
Color3_Space< double > & copyFrom(Color3_Space< double > const &b)
Copy method.
double const & yuvMax(size_t i) const
double const & uMax() const
YUVf_Space operator-(YUVf_Space const &b) const
doubleconst & val(size_t id) const
Return the value of the i -th channel.
double const & y(double c)
double const & vMin() const
double const & vMax() const