40#include <visp3/core/vpColor.h>
41#include <visp3/core/vpException.h>
42#include <visp3/core/vpRGBa.h>
43#include <visp3/core/vpHSV.h>
103 const unsigned int val_4 = 4;
104 if (v.getRows() != val_4) {
107 const unsigned int index_0 = 0;
108 const unsigned int index_1 = 1;
109 const unsigned int index_2 = 2;
110 const unsigned int index_3 = 3;
111 R =
static_cast<unsigned char>(v[index_0]);
112 G =
static_cast<unsigned char>(v[index_1]);
113 B =
static_cast<unsigned char>(v[index_2]);
114 A =
static_cast<unsigned char>(v[index_3]);
125 return (
R == v.R) && (
G == v.G) && (
B == v.B) && (
A == v.A);
142 const unsigned int index_0 = 0;
143 const unsigned int index_1 = 1;
144 const unsigned int index_2 = 2;
145 const unsigned int index_3 = 3;
146 n[index_0] =
static_cast<double>(
R) -
static_cast<double>(v.R);
147 n[index_1] =
static_cast<double>(
G) -
static_cast<double>(v.G);
148 n[index_2] =
static_cast<double>(
B) -
static_cast<double>(v.B);
149 n[index_3] =
static_cast<double>(
A) -
static_cast<double>(v.A);
162 n.
R =
static_cast<unsigned char>(
R + v.R);
163 n.
G =
static_cast<unsigned char>(
G + v.G);
164 n.
B =
static_cast<unsigned char>(
B + v.B);
165 n.
A =
static_cast<unsigned char>(
A + v.A);
177 const unsigned int index_0 = 0;
178 const unsigned int index_1 = 1;
179 const unsigned int index_2 = 2;
180 const unsigned int index_3 = 3;
181 n[index_0] =
R - v[index_0];
182 n[index_1] =
G - v[index_1];
183 n[index_2] =
B - v[index_2];
184 n[index_3] =
A - v[index_3];
196 const unsigned int index_0 = 0;
197 const unsigned int index_1 = 1;
198 const unsigned int index_2 = 2;
199 const unsigned int index_3 = 3;
200 n[index_0] =
R + v[index_0];
201 n[index_1] =
G + v[index_1];
202 n[index_2] =
B + v[index_2];
203 n[index_3] =
A + v[index_3];
215 const unsigned int index_0 = 0;
216 const unsigned int index_1 = 1;
217 const unsigned int index_2 = 2;
218 const unsigned int index_3 = 3;
234 const unsigned int index_0 = 0;
235 const unsigned int index_1 = 1;
236 const unsigned int index_2 = 2;
237 const unsigned int index_3 = 3;
247 double gray1 = (0.2126 *
R) + (0.7152 *
G) + (0.0722 *
B);
248 double gray2 = (0.2126 * v.R) + (0.7152 * v.G) + (0.0722 * v.B);
250 return (gray1 < gray2);
255 double gray1 = (0.2126 *
R) + (0.7152 *
G) + (0.0722 *
B);
256 double gray2 = (0.2126 * v.R) + (0.7152 * v.G) + (0.0722 * v.B);
258 return (gray1 > gray2);
271 rgba.
R =
static_cast<unsigned char>(rgb.
R * x);
272 rgba.
G =
static_cast<unsigned char>(rgb.
G * x);
273 rgba.
B =
static_cast<unsigned char>(rgb.
B * x);
305 os <<
"(" <<
static_cast<int>(rgba.
R) <<
"," <<
static_cast<int>(rgba.
G) <<
"," <<
static_cast<int>(rgba.
B) <<
"," <<
static_cast<int>(rgba.
A) <<
")";
Implementation of column vector and the associated operations.
error that can be emitted by ViSP classes.
@ dimensionError
Bad dimension.
vpColVector operator-(const vpRGBa &v) const
unsigned char B
Blue component.
unsigned char R
Red component.
bool operator<(const vpRGBa &v) const
friend VISP_EXPORT std::ostream & operator<<(std::ostream &os, const vpRGBa &rgba)
vpRGBa operator+(const vpRGBa &v) const
unsigned char G
Green component.
unsigned char A
Additional component.
bool operator>(const vpRGBa &v) const
vpRGBa & operator=(const unsigned char &v)
vpColVector operator*(const float &v) const
bool operator!=(const vpRGBa &v) const
bool operator==(const vpRGBa &v) const