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);
82 const unsigned int rows_size = 3;
83 const unsigned int index_0 = 0;
84 const unsigned int index_1 = 1;
85 const unsigned int index_2 = 2;
87 if (v.getRows() != rows_size) {
90 R =
static_cast<float>(v[index_0]);
91 G =
static_cast<float>(v[index_1]);
92 B =
static_cast<float>(v[index_2]);
103 if (std::fabs(
R - v.R) > std::numeric_limits<float>::epsilon()) {
106 if (std::fabs(
G - v.G) > std::numeric_limits<float>::epsilon()) {
109 if (std::fabs(
B - v.B) > std::numeric_limits<float>::epsilon()) {
122 return ((std::fabs(
R - v.R) > std::numeric_limits<float>::epsilon()) ||
123 (std::fabs(
G - v.G) > std::numeric_limits<float>::epsilon()) ||
124 (std::fabs(
B - v.B) > std::numeric_limits<float>::epsilon()));
135 const unsigned int index_0 = 0;
136 const unsigned int index_1 = 1;
137 const unsigned int index_2 = 2;
138 n[index_0] =
static_cast<double>(
R) -
static_cast<double>(v.R);
139 n[index_1] =
static_cast<double>(
G) -
static_cast<double>(v.G);
140 n[index_2] =
static_cast<double>(
B) -
static_cast<double>(v.B);
167 const unsigned int index_0 = 0;
168 const unsigned int index_1 = 1;
169 const unsigned int index_2 = 2;
170 n[index_0] =
R - v[index_0];
171 n[index_1] =
G - v[index_1];
172 n[index_2] =
B - v[index_2];
184 const unsigned int index_0 = 0;
185 const unsigned int index_1 = 1;
186 const unsigned int index_2 = 2;
187 n[index_0] =
R + v[index_0];
188 n[index_1] =
G + v[index_1];
189 n[index_2] =
B + v[index_2];
201 const unsigned int index_0 = 0;
202 const unsigned int index_1 = 1;
203 const unsigned int index_2 = 2;
218 const unsigned int index_0 = 0;
219 const unsigned int index_1 = 1;
220 const unsigned int index_2 = 2;
229 double gray1 = (0.2126 *
R) + (0.7152 *
G) + (0.0722 *
B);
230 double gray2 = (0.2126 * v.R) + (0.7152 * v.G) + (0.0722 * v.B);
232 return (gray1 < gray2);
237 double gray1 = (0.2126 *
R) + (0.7152 *
G) + (0.0722 *
B);
238 double gray2 = (0.2126 * v.R) + (0.7152 * v.G) + (0.0722 * v.B);
240 return (gray1 > gray2);
253 rgbf.
R =
static_cast<float>(rgb.
R * x);
254 rgbf.
G =
static_cast<float>(rgb.
G * x);
255 rgbf.
B =
static_cast<float>(rgb.
B * x);
302 os <<
"(" << rgb.
R <<
"," << rgb.
G <<
"," << rgb.
B <<
")";
Implementation of column vector and the associated operations.
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
friend VISP_EXPORT std::ostream & operator<<(std::ostream &os, const vpRGBf &rgb)
bool operator<(const vpRGBf &v) const
bool operator!=(const vpRGBf &v) const