3 #include <ldpk/ldpk_ldp_builtin.h> 12 template <
class VEC2,
class MAT2>
16 typedef VEC2 vec2_type;
17 typedef MAT2 mat2_type;
22 static const char* _para[3];
24 bool decypher(
const char* name,
int& i)
31 if(0 == strcmp(name,_para[i]))
38 bool initializeParameters()
41 bt::check_builtin_parameters();
44 bool getNumParameters(
int& n)
49 bool getParameterName(
int i,
char* identifier)
51 strcpy(identifier,_para[i]);
54 bool setParameterValue(
const char *identifier,
double v)
59 if(bt::set_builtin_parameter_value(identifier,v))
63 if(!decypher(identifier,i))
70 { bt::no_longer_uptodate_lut(); }
75 virtual bool undistort(
double x0,
double y0,
double &x1,
double &y1)
78 vec2_type q_dn = _radial.
eval(bt::map_unit_to_dn(vec2_type(x0,y0)));
86 if(norm2(q_dn) > 100.0)
87 { q_dn = 100.0 * unit(q_dn); }
89 vec2_type q = bt::map_dn_to_unit(q_dn);
94 virtual bool distort(
double x0,
double y0,
double &x1,
double &y1)
103 if(!bt::is_uptodate_lut())
106 if(!bt::is_uptodate_lut())
114 vec2_type p_dn = bt::map_unit_to_dn(vec2_type(x0,y0));
115 if(!_radial.check_domain(p_dn))
122 vec2_type qs = bt::get_lut().get_initial_value(vec2_type(x0,y0));
124 vec2_type q = bt::map_dn_to_unit(
126 bt::map_unit_to_dn(vec2_type(x0,y0)),
127 bt::map_unit_to_dn(qs)));
132 virtual bool distort(
double x0,
double y0,
double x1_start,
double y1_start,
double &x1,
double &y1)
134 typedef base_type bt;
137 vec2_type p_dn = bt::map_unit_to_dn(vec2_type(x0,y0));
138 if(!_radial.check_domain(p_dn))
143 vec2_type q = bt::map_dn_to_unit(
145 bt::map_unit_to_dn(vec2_type(x0,y0)),
146 bt::map_unit_to_dn(vec2_type(x1_start,y1_start))));
159 #ifdef LDPK_COMPILE_AS_PLUGIN_SDV 160 strcpy(name,
"3DE4 Radial - Homomorphic, Degree 2 [Plugin]");
162 strcpy(name,
"3DE4 Radial - Homomorphic, Degree 2");
168 typedef base_type bt;
170 if(bt::get_builtin_parameter_type(identifier,ptype))
return true;
171 if(!decypher(identifier,i))
return false;
172 ptype = TDE4_LDP_ADJUSTABLE_DOUBLE;
177 typedef base_type bt;
179 if(!decypher(identifier,i))
return false;
185 typedef base_type bt;
187 if(!decypher(identifier,i))
return false;
193 else if((i == 1) || (i == 2))
202 typedef base_type bt;
203 mat2_type m = _radial.
jacobi(
204 bt::map_unit_to_dn(vec2_type(x0,y0)));
206 mat2_type u2d(bt::w_fb_cm() / bt::r_fb_cm(),0.0,0.0,bt::h_fb_cm() / bt::r_fb_cm());
207 mat2_type d2u(bt::r_fb_cm() / bt::w_fb_cm(),0.0,0.0,bt::r_fb_cm() / bt::h_fb_cm());
209 m00 = m[0][0];m01 = m[0][1];m10 = m[1][0];m11 = m[1][1];
214 template <
class VEC2,
class MAT2>
Plugin class for homomorphic radial distortion with decentering Not sure if parameters can be calcula...
Definition: tde4_ldp_radial_homomorphic_decentered_deg_2.experimental.h:13
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_radial_homomorphic_decentered_deg_2.experimental.h:166
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_radial_homomorphic_decentered_deg_2.experimental.h:157
void set_coeff(int i, double q)
Set coefficient c[i], 0 <= i < 3.
Definition: ldpk_radial_homomorphic_decentered_distortion.h:42
bool getParameterDefaultValue(const char *identifier, double &v)
returns default value for given parameter (maximum length of "char *v": 1000 bytes)......
Definition: tde4_ldp_radial_homomorphic_decentered_deg_2.experimental.h:175
vec2_type eval(const vec2_type &p) const
Same as method instead of operator.
Definition: ldpk_generic_distortion_base.h:102
mat2_type jacobi(const vec2_type &p_dn) const
Analytic version of the Jacobi-matrix.
Definition: ldpk_radial_homomorphic_decentered_distortion.h:94
A polynomial radially symmetric model of degree 4 with decentering.
bool getParameterRange(const char *identifier, double &a, double &b)
returns range for adjustable double parameters...
Definition: tde4_ldp_radial_homomorphic_decentered_deg_2.experimental.h:183
bool getJacobianMatrix(double x0, double y0, double &m00, double &m01, double &m10, double &m11)
calculate the Jacobian matrix of the undistort()-Method. Overwrite this, if you know the Jacobian for...
Definition: tde4_ldp_radial_homomorphic_decentered_deg_2.experimental.h:200
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
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:120
double get_coeff(int i) const
Get coefficient c[i], 0 <= i < 3.
Definition: ldpk_radial_homomorphic_decentered_distortion.h:36