23 #ifndef MODULES_REMOTE_MOSAIC_INCLUDE_OTBMOSAICFUNCTORS_H_
24 #define MODULES_REMOTE_MOSAIC_INCLUDE_OTBMOSAICFUNCTORS_H_
27 #include "vnl/vnl_matrix.h"
28 #include "vcl_compiler.h"
42 template <
class TInput,
class TOutput>
62 D1[0][0] = 1.0 / vcl_sqrt(3.0);
63 D1[1][1] = 1.0 / vcl_sqrt(6.0);
64 D1[2][2] = 1.0 / vcl_sqrt(2.0);
84 return !(*
this != other);
92 if (A[0] == 0 && A[1] == 0 && A[2] == 0)
99 vnl_matrix<double> rgb(3, 1);
105 vnl_matrix<double> lms(3, 1);
109 const double log10 = vcl_log(10);
110 lms[0][0] = vcl_log(lms[0][0]) / log10;
111 lms[1][0] = vcl_log(lms[1][0]) / log10;
112 lms[2][0] = vcl_log(lms[2][0]) / log10;
115 vnl_matrix<double> lab(3, 1);
116 lab =
D1 * (
D2 * lms);
118 output[0] = lab[0][0];
119 output[1] = lab[1][0];
120 output[2] = lab[2][0];
131 vnl_matrix<double>
M;
132 vnl_matrix<double>
D1;
133 vnl_matrix<double>
D2;
144 template <
class TInput,
class TOutput>
164 D1[0][0] = 1.0 / vcl_sqrt(3.0);
165 D1[1][1] = 1.0 / vcl_sqrt(6.0);
166 D1[2][2] = 1.0 / vcl_sqrt(2.0);
186 return !(*
this != other);
195 if (A[0] == 0 && A[1] == 0 && A[2] == 0)
201 vnl_matrix<double> lab(3, 1);
207 vnl_matrix<double> lms(3, 1);
208 lms =
D2 * (
D1 * lab);
209 lms[0][0] = vcl_pow(10.0, lms[0][0]);
210 lms[1][0] = vcl_pow(10.0, lms[1][0]);
211 lms[2][0] = vcl_pow(10.0, lms[2][0]);
214 vnl_matrix<double> rgb(3, 1);
217 output[0] = rgb[0][0];
218 output[1] = rgb[1][0];
219 output[2] = rgb[2][0];
230 vnl_matrix<double>
M;
231 vnl_matrix<double>
D1;
232 vnl_matrix<double>
D2;