13 #ifndef IMAGE_MATRIX_HPP
14 #define IMAGE_MATRIX_HPP
29 matrix(
int rows,
int columns, std::vector<double> values,
image *
L)
30 :
image(L), rows(rows), columns(columns), values(values)
33 throw std::runtime_error(
"Mismatched color matrix size");
36 virtual double get(
int i,
int j,
int k)
const
41 if (0 <= k && k < rows)
42 for (
int l = 0; l < d; l++)
43 if (
double w = values[k * columns + l])
44 v += w *
L->
get(i, j, l);
53 virtual void doc(std::ostream& out)
const
55 out <<
"matrix " << rows <<
" " << columns;
61 std::vector<double> values;
76 static const double v[9];
79 const double rgb2yuv::v[9] = {
80 0.29900, 0.58700, 0.11400,
81 -0.14713, 0.28886, 0.43600,
82 0.61500, -0.51499, 0.10001
97 static const double v[9];
100 const double yuv2rgb::v[9] = {
101 1.00000, 0.00000, 1.13983,
102 1.00000, -0.39465, -0.58060,
103 1.00000, 2.03211, 0.00000
virtual double get(int i, int j, int k) const =0
Return the value of the sample at row i, column j, channel k.
image * L
Left child.
Definition: image.hpp:117
Color matrix transformation filter.
Definition: image_matrix.hpp:20
Base class for all image sources, filters, and operators.
Definition: image.hpp:20
YUV to RGB color space transformation.
Definition: image_matrix.hpp:89
virtual void doc(std::ostream &out) const
Produce a string documenting the function of this object.
Definition: image_matrix.hpp:53
virtual int get_depth() const
Return the depth of this image.
Definition: image.hpp:66
RGB to YUV color space transformation.
Definition: image_matrix.hpp:68
matrix(int rows, int columns, std::vector< double > values, image *L)
Apply a color space transformation to image L. This transformation is given in the form of a matrix o...
Definition: image_matrix.hpp:29
yuv2rgb(image *L)
Transform image L from the YUV to the RGB color space.
Definition: image_matrix.hpp:94
rgb2yuv(image *L)
Transform image L from the RGB to the YUV color space.
Definition: image_matrix.hpp:73
virtual int get_depth() const
Return the depth of this image.
Definition: image_matrix.hpp:48