1 #ifndef tde4_ldp_radial_deg_8_release_1_sdv
2 #define tde4_ldp_radial_deg_8_release_1_sdv
4 #include <ldpk/ldpk_ldp_builtin.h>
13 template <
class VEC2,
class MAT2>
17 typedef VEC2 vec2_type;
18 typedef MAT2 mat2_type;
23 static const char* _para[4];
25 bool decypher(
const char* name,
int& i)
32 if(0 == strcmp(name,_para[i]))
39 bool initializeParameters()
42 bt::check_builtin_parameters();
45 bool getNumParameters(
int& n)
50 bool getParameterName(
int i,
char* identifier)
52 strcpy(identifier,_para[i]);
55 bool setParameterValue(
const char *identifier,
double v)
60 if(bt::set_builtin_parameter_value(identifier,v))
64 if(!decypher(identifier,i))
70 bt::no_longer_uptodate_lut();
77 bool undistort(
double x0,
double y0,
double &x1,
double &y1)
80 vec2_type p_plain_dn = bt::map_unit_to_dn(vec2_type(x0,y0));
83 vec2_type q_dn = _distortion.
eval(p_plain_dn);
84 if(norm2(q_dn) > 50.0) q_dn = 50.0 * unit(q_dn);
86 vec2_type q = bt::map_dn_to_unit(q_dn);
91 bool distort(
double x0,
double y0,
double &x1,
double &y1)
100 if(!bt::is_uptodate_lut())
103 if(!bt::is_uptodate_lut())
111 vec2_type qs = bt::get_lut().get_initial_value(vec2_type(x0,y0));
113 vec2_type p_plain_dn = _distortion.
map_inverse(bt::map_unit_to_dn(vec2_type(x0,y0)),bt::map_unit_to_dn(qs));
115 vec2_type q = bt::map_dn_to_unit(p_plain_dn);
120 bool distort(
double x0,
double y0,
double x1_start,
double y1_start,
double &x1,
double &y1)
123 vec2_type p_plain_dn = _distortion.
map_inverse(bt::map_unit_to_dn(vec2_type(x0,y0)),bt::map_unit_to_dn(vec2_type(x1_start,y1_start)));
125 vec2_type q = bt::map_dn_to_unit(p_plain_dn);
135 #ifdef LDPK_COMPILE_AS_PLUGIN_SDV
136 strcpy(name,
"3DE4 Radial - Fisheye, Degree 8, Release 1 [Plugin]");
138 strcpy(name,
"3DE4 Radial - Fisheye, Degree 8, Release 1");
146 if(bt::get_builtin_parameter_type(identifier,ptype))
return true;
147 if(!decypher(identifier,i))
return false;
148 ptype = TDE4_LDP_ADJUSTABLE_DOUBLE;
155 if(!decypher(identifier,i))
return false;
163 if(!decypher(identifier,i))
return false;
170 template <
class VEC2,
class MAT2>
172 "Distortion - Degree 2",
173 "Quartic Distortion - Degree 4",
A polynomial radially symmetric model of degree N (even)
bool getParameterDefaultValue(const char *identifier, double &v)
returns default value for given parameter (maximum length of "char *v": 1000 bytes)......
Definition: tde4_ldp_radial_deg_8_release_1.h:151
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_deg_8_release_1.h:133
Plugin class for radial distortion. Does not compensate for decentering. Parameters can be calculated...
Definition: tde4_ldp_radial_deg_8_release_1.h:14
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_radial_deg_8_release_1.h:142
bool getParameterRange(const char *identifier, double &a, double &b)
returns range for adjustable double parameters...
Definition: tde4_ldp_radial_deg_8_release_1.h:159
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:122
void set_coeff(int i, double q)
Set coefficient c[i], 0 <= i < N.
Definition: ldpk_generic_radial_distortion.h:38
double get_coeff(int i) const
Get coefficient c[i], 0 <= i < N (i.e. coefficient power r^(2i))
Definition: ldpk_generic_radial_distortion.h:32