41 #include <visp3/core/vpColor.h>
42 #include <visp3/core/vpException.h>
43 #include <visp3/core/vpRGBf.h>
66 this->
R =
static_cast<float>(v);
67 this->
G =
static_cast<float>(v);
68 this->
B =
static_cast<float>(v);
83 #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
89 this->
R = std::move(v.R);
90 this->
G = std::move(v.G);
91 this->
B = std::move(v.B);
106 const unsigned int rows_size = 3;
107 const unsigned int index_0 = 0;
108 const unsigned int index_1 = 1;
109 const unsigned int index_2 = 2;
111 if (v.
getRows() != rows_size) {
114 R =
static_cast<float>(v[index_0]);
115 G =
static_cast<float>(v[index_1]);
116 B =
static_cast<float>(v[index_2]);
127 if (std::fabs(
R - v.
R) > std::numeric_limits<float>::epsilon()) {
130 if (std::fabs(
G - v.
G) > std::numeric_limits<float>::epsilon()) {
133 if (std::fabs(
B - v.
B) > std::numeric_limits<float>::epsilon()) {
146 return ((std::fabs(
R - v.
R) > std::numeric_limits<float>::epsilon()) ||
147 (std::fabs(
G - v.
G) > std::numeric_limits<float>::epsilon()) ||
148 (std::fabs(
B - v.
B) > std::numeric_limits<float>::epsilon()));
159 const unsigned int index_0 = 0;
160 const unsigned int index_1 = 1;
161 const unsigned int index_2 = 2;
162 n[index_0] =
static_cast<double>(
R) -
static_cast<double>(v.
R);
163 n[index_1] =
static_cast<double>(
G) -
static_cast<double>(v.
G);
164 n[index_2] =
static_cast<double>(
B) -
static_cast<double>(v.
B);
191 const unsigned int index_0 = 0;
192 const unsigned int index_1 = 1;
193 const unsigned int index_2 = 2;
194 n[index_0] =
R - v[index_0];
195 n[index_1] =
G - v[index_1];
196 n[index_2] =
B - v[index_2];
208 const unsigned int index_0 = 0;
209 const unsigned int index_1 = 1;
210 const unsigned int index_2 = 2;
211 n[index_0] =
R + v[index_0];
212 n[index_1] =
G + v[index_1];
213 n[index_2] =
B + v[index_2];
225 const unsigned int index_0 = 0;
226 const unsigned int index_1 = 1;
227 const unsigned int index_2 = 2;
242 const unsigned int index_0 = 0;
243 const unsigned int index_1 = 1;
244 const unsigned int index_2 = 2;
253 double gray1 = (0.2126 *
R) + (0.7152 *
G) + (0.0722 *
B);
254 double gray2 = (0.2126 * v.
R) + (0.7152 * v.
G) + (0.0722 * v.
B);
256 return (gray1 < gray2);
261 double gray1 = (0.2126 *
R) + (0.7152 *
G) + (0.0722 *
B);
262 double gray2 = (0.2126 * v.
R) + (0.7152 * v.
G) + (0.0722 * v.
B);
264 return (gray1 > gray2);
277 rgbf.
R =
static_cast<float>(rgb.
R * x);
278 rgbf.
G =
static_cast<float>(rgb.
G * x);
279 rgbf.
B =
static_cast<float>(rgb.
B * x);
326 os <<
"(" << rgb.
R <<
"," << rgb.
G <<
"," << rgb.
B <<
")";
friend std::ostream & operator<<(std::ostream &s, const vpArray2D< Type > &A)
unsigned int getRows() const
Implementation of column vector and the associated operations.
vpColVector operator*(const double &x, const vpColVector &v)
error that can be emitted by ViSP classes.
@ dimensionError
Bad dimension.
vpColVector operator*(float v) const
vpColVector operator-(const vpRGBf &v) const
bool operator>(const vpRGBf &v) const
bool operator==(const vpRGBf &v) const
vpRGBf & operator=(float v)
vpRGBf operator+(const vpRGBf &v) const
bool operator<(const vpRGBf &v) const
bool operator!=(const vpRGBf &v) const