1 #ifndef tde4_ldp_anamorphic_deg_6_sdv 2 #define tde4_ldp_anamorphic_deg_6_sdv 4 #include <ldpk/ldpk_ldp_builtin.h> 5 #include <ldpk/ldpk_generic_anamorphic_distortion.h> 13 template <
class VEC2,
class MAT2>
17 typedef VEC2 vec2_type;
18 typedef MAT2 mat2_type;
24 static const char* _para[18];
26 bool decypher(
const char* name,
int& i)
33 if(0 == strcmp(name,_para[i]))
38 bool initializeParameters()
41 bt::check_builtin_parameters();
43 _anamorphic.prepare();
46 bool getNumParameters(
int& n)
51 bool getParameterName(
int i,
char* identifier)
53 strcpy(identifier,_para[i]);
56 bool setParameterValue(
const char *identifier,
double v)
61 if(bt::set_builtin_parameter_value(identifier,v))
65 if(!decypher(identifier,i))
72 { bt::no_longer_uptodate_lut(); }
78 virtual bool undistort(
double x0,
double y0,
double &x1,
double &y1)
81 vec2_type q = bt::map_dn_to_unit(
83 bt::map_unit_to_dn(vec2_type(x0,y0))));
88 virtual bool distort(
double x0,
double y0,
double &x1,
double &y1)
97 if(!bt::is_uptodate_lut())
100 if(!bt::is_uptodate_lut())
108 vec2_type qs = bt::get_lut().get_initial_value(vec2_type(x0,y0));
111 vec2_type q = bt::map_dn_to_unit(
113 bt::map_unit_to_dn(vec2_type(x0,y0)),
114 bt::map_unit_to_dn(qs)));
119 virtual bool distort(
double x0,
double y0,
double x1_start,
double y1_start,
double &x1,
double &y1)
121 typedef base_type bt;
122 vec2_type q = bt::map_dn_to_unit(
124 bt::map_unit_to_dn(vec2_type(x0,y0)),
125 bt::map_unit_to_dn(vec2_type(x1_start,y1_start))));
138 #ifdef LDPK_COMPILE_AS_PLUGIN_SDV 139 strcpy(name,
"3DE4 Anamorphic, Degree 6 [Plugin]");
141 strcpy(name,
"3DE4 Anamorphic, Degree 6");
147 typedef base_type bt;
149 if(bt::get_builtin_parameter_type(identifier,ptype))
return true;
150 if(!decypher(identifier,i))
return false;
151 ptype = TDE4_LDP_ADJUSTABLE_DOUBLE;
156 typedef base_type bt;
158 if(!decypher(identifier,i))
return false;
164 typedef base_type bt;
166 if(!decypher(identifier,i))
return false;
174 typedef base_type bt;
175 mat2_type m = _anamorphic.
jacobi(bt::map_unit_to_dn(vec2_type(x0,y0)));
177 mat2_type u2d(bt::w_fb_cm() / bt::r_fb_cm(),0.0,0.0,bt::h_fb_cm() / bt::r_fb_cm());
178 mat2_type d2u(bt::r_fb_cm() / bt::w_fb_cm(),0.0,0.0,bt::r_fb_cm() / bt::h_fb_cm());
180 m00 = m[0][0];m01 = m[0][1];m10 = m[1][0];m11 = m[1][1];
185 typedef base_type bt;
186 vec2_type t = _anamorphic.twist(bt::map_unit_to_dn(vec2_type(x0,y0)));
187 t0 = t[0] * (bt::h_fb_cm() / (bt::r_fb_cm()));t1 = t[1] * (bt::w_fb_cm() / (bt::r_fb_cm()));
192 template <
class VEC2,
class MAT2>
194 "Cx02 - Degree 2",
"Cy02 - Degree 2",
195 "Cx22 - Degree 2",
"Cy22 - Degree 2",
197 "Cx04 - Degree 4",
"Cy04 - Degree 4",
198 "Cx24 - Degree 4",
"Cy24 - Degree 4",
199 "Cx44 - Degree 4",
"Cy44 - Degree 4",
201 "Cx06 - Degree 6",
"Cy06 - Degree 6",
202 "Cx26 - Degree 6",
"Cy26 - Degree 6",
203 "Cx46 - Degree 6",
"Cy46 - Degree 6",
204 "Cx66 - Degree 6",
"Cy66 - Degree 6" bool getModelName(char *name)
returns a name for the model as to show up in the GUI (maximum length of "name": 100 bytes)...
Definition: tde4_ldp_anamorphic_deg_6.h:136
virtual mat2_type jacobi(const vec2_type &p_dn) const
Jacobi-Matrix. The result is a matrix g_{ij} = d/dp_j f(p)_i, where f represents the undistort-functi...
Definition: ldpk_generic_distortion_base.h:109
vec2_type eval(const vec2_type &p) const
Same as method instead of operator.
Definition: ldpk_generic_distortion_base.h:104
bool getParameterType(const char *identifier, tde4_ldp_ptype &ptype)
returns type of given parameter... The method should return false, if the parameter addressed by iden...
Definition: tde4_ldp_anamorphic_deg_6.h:145
void set_coeff(int i, double q)
Set coefficient as demanded by base class.
Definition: ldpk_generic_anamorphic_distortion.h:77
bool getTwistVector(double x0, double y0, double &t0, double &t1)
calculate the mixed derivatives ("twist vector") of the undistort()-Method. Overwrite this...
Definition: tde4_ldp_anamorphic_deg_6.h:183
bool getParameterRange(const char *identifier, double &a, double &b)
returns range for adjustable double parameters...
Definition: tde4_ldp_anamorphic_deg_6.h:162
bool getJacobianMatrix(double x0, double y0, double &m00, double &m01, double &m10, double &m11)
Tested against difference quotients.
Definition: tde4_ldp_anamorphic_deg_6.h:172
This class handles the built-in parameter and the lookup table. You may find it useful for your own d...
Definition: ldpk_ldp_builtin.h:31
bool getParameterDefaultValue(const char *identifier, double &v)
returns default value for given parameter (maximum length of "char *v": 1000 bytes)......
Definition: tde4_ldp_anamorphic_deg_6.h:154
Plugin class for anamorphic distortion. Does not compensate for decentering. Parameters can be calcul...
Definition: tde4_ldp_anamorphic_deg_6.h:14
virtual vec2_type map_inverse(const vec2_type &q) const
Inverse mapping by solving the fixed point equation without providing initial values. Virtual, because the derived class might use some smart data structure for calculating an initial value.
Definition: ldpk_generic_distortion_base.h:122
double get_coeff(int i) const
Get coefficient as demanded by base class.
Definition: ldpk_generic_anamorphic_distortion.h:71