3 #include <ldpk/ldpk_ldp_builtin.h> 11 template <
class VEC2,
class MAT2>
21 static const char* _para[4];
22 double _r_clip_factor;
25 bool decypher(
const char* name,
int& i)
32 if(0 == strcmp(name,_para[i]))
40 bt::check_builtin_parameters();
42 _fl_dn = bt::fl_cm() / bt::r_fb_cm();
52 strcpy(identifier,_para[i]);
60 if(bt::set_builtin_parameter_value(identifier,v))
62 if(!decypher(identifier,i))
65 { bt::no_longer_uptodate_lut(); }
70 bool undistort(
double x0,
double y0,
double &x1,
double &y1)
74 vec2 p_ed_dist_dn = bt::map_unit_to_dn(vec2(x0,y0));
77 double r_ed_dist_dn = norm2(p_ed_dist_dn);
82 double the_undist = _distortion(r_ed_dist_dn / _fl_dn);
84 double phi = ::atan2(p_ed_dist_dn[1],p_ed_dist_dn[0]);
85 double the = the_undist;
88 { phi += 2.0 * M_PI; }
90 x1 = phi / (2.0 * M_PI);
94 bool distort(
double x0,
double y0,
double &x1,
double &y1)
98 double phi = x0 * (2.0 * M_PI);
99 double the = y0 * M_PI;
101 double r_ed_dist_dn = _fl_dn * _distortion.
map_inverse(the);
102 vec2 p_ed_dn = r_ed_dist_dn * vec2(::cos(phi),::sin(phi));
104 vec2 q_ed_unit = bt::map_dn_to_unit(p_ed_dn);
116 double r_clip_factor()
const 117 {
return _r_clip_factor; }
118 void r_clip_factor(
double f)
119 { _r_clip_factor = f; }
122 #ifdef LDPK_COMPILE_AS_PLUGIN_SDV 123 strcpy(name,
"3DE4 Radial - Fisheye, Equidistant, Longlat, Degree 8 [Plugin]");
125 strcpy(name,
"3DE4 Radial - Fisheye, Equidistant, Longlat, Degree 8");
131 typedef base_type bt;
133 if(bt::get_builtin_parameter_type(identifier,ptype))
return true;
134 if(!decypher(identifier,i))
return false;
135 ptype = TDE4_LDP_ADJUSTABLE_DOUBLE;
140 typedef base_type bt;
142 if(!decypher(identifier,i))
return false;
148 typedef base_type bt;
150 if(!decypher(identifier,i))
return false;
163 template <
class VEC2,
class MAT2>
double map_inverse(double q) const
Inverse mapping by solving the fixed point equation without providing initial values.
Definition: ldpk_generic_radial_distortion_1d.h:96
void set_coeff(int i, double q)
Set coefficient c[i], 0 <= i < N.
Definition: ldpk_generic_radial_distortion_1d.h:59
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_fisheye_equidistant_longlat_y_deg_8.experimental.h:120
bool initializeParameters()
prepare the current set of parameters...
Definition: tde4_ldp_radial_fisheye_equidistant_longlat_y_deg_8.experimental.h:37
bool getParameterDefaultValue(const char *identifier, double &v)
returns default value for given parameter (maximum length of "char *v": 1000 bytes)......
Definition: tde4_ldp_radial_fisheye_equidistant_longlat_y_deg_8.experimental.h:138
bool getParameterRange(const char *identifier, double &a, double &b)
returns range for adjustable double parameters...
Definition: tde4_ldp_radial_fisheye_equidistant_longlat_y_deg_8.experimental.h:146
bool getNumParameters(int &n)
returns the number of plugin parameters...
Definition: tde4_ldp_radial_fisheye_equidistant_longlat_y_deg_8.experimental.h:45
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_fisheye_equidistant_longlat_y_deg_8.experimental.h:129
A polynomial radially symmetric model of degree N (even)
bool undistort(double x0, double y0, double &x1, double &y1)
warp/unwarp 2D points...
Definition: tde4_ldp_radial_fisheye_equidistant_longlat_y_deg_8.experimental.h:70
bool setParameterValue(const char *identifier, double v)
set parameter values... parameters predefined by 3DE4: "tde4_focal_length_cm", "tde4_filmback_width_c...
Definition: tde4_ldp_radial_fisheye_equidistant_longlat_y_deg_8.experimental.h:55
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
Plugin class for radial distortion. Does not compensate for decentering.
Definition: tde4_ldp_radial_fisheye_equidistant_longlat_y_deg_8.experimental.h:12
bool getParameterName(int i, char *identifier)
returns "identifier" name of parameter "i" (maximum length of "identifier": 100 bytes)...
Definition: tde4_ldp_radial_fisheye_equidistant_longlat_y_deg_8.experimental.h:50
double get_coeff(int i) const
Get coefficient c[i], 0 <= i < N (i.e. coefficient power r^(2i))
Definition: ldpk_generic_radial_distortion_1d.h:53