1 #ifndef tde4_ldp_classic_3de_mixed_sdv 2 #define tde4_ldp_classic_3de_mixed_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[5];
25 bool decypher(
const char* name,
int& i)
32 if(0 == strcmp(name,_para[i]))
42 bt::check_builtin_parameters();
52 strcpy(identifier,_para[i]);
60 if(bt::set_builtin_parameter_value(identifier,v))
64 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 = bt::map_dn_to_unit(_distortion.
eval(bt::map_unit_to_dn(vec2_type(x0,y0))));
83 virtual bool distort(
double x0,
double y0,
double &x1,
double &y1)
92 if(!bt::is_uptodate_lut())
95 if(!bt::is_uptodate_lut())
103 vec2_type qs = bt::get_lut().get_initial_value(vec2_type(x0,y0));
105 vec2_type q = bt::map_dn_to_unit(_distortion.
map_inverse(bt::map_unit_to_dn(vec2_type(x0,y0)),bt::map_unit_to_dn(qs)));
110 virtual bool distort(
double x0,
double y0,
double x1_start,
double y1_start,
double &x1,
double &y1)
112 typedef base_type bt;
113 vec2_type q = bt::map_dn_to_unit(_distortion.
map_inverse(bt::map_unit_to_dn(vec2_type(x0,y0)),bt::map_unit_to_dn(vec2_type(x1_start,y1_start))));
126 #ifdef LDPK_COMPILE_AS_PLUGIN_SDV 127 strcpy(name,
"3DE Classic LD Model [Plugin]");
129 strcpy(name,
"3DE Classic LD Model");
135 typedef base_type bt;
137 if(bt::get_builtin_parameter_type(identifier,ptype))
return true;
138 if(!decypher(identifier,i))
return false;
139 ptype = TDE4_LDP_ADJUSTABLE_DOUBLE;
144 typedef base_type bt;
146 if(!decypher(identifier,i))
return false;
148 v = (i == 1) ? 1.0 : 0.0;
153 typedef base_type bt;
155 if(!decypher(identifier,i))
return false;
172 typedef base_type bt;
173 mat2_type m = _distortion.
jacobi(bt::map_unit_to_dn(vec2_type(x0,y0)));
174 mat2_type u2d(bt::w_fb_cm() / bt::r_fb_cm(),0.0,0.0,bt::h_fb_cm() / bt::r_fb_cm());
175 mat2_type d2u(bt::r_fb_cm() / bt::w_fb_cm(),0.0,0.0,bt::r_fb_cm() / bt::h_fb_cm());
177 m00 = m[0][0];m01 = m[0][1];m10 = m[1][0];m11 = m[1][1];
182 template <
class VEC2,
class MAT2>
185 "Anamorphic Squeeze",
bool getNumParameters(int &n)
returns the number of plugin parameters...
Definition: tde4_ldp_classic_3de_mixed.h:45
bool getJacobianMatrix(double x0, double y0, double &m00, double &m01, double &m10, double &m11)
Tested against difference quotients.
Definition: tde4_ldp_classic_3de_mixed.h:170
virtual bool undistort(double x0, double y0, double &x1, double &y1)
warp/unwarp 2D points...
Definition: tde4_ldp_classic_3de_mixed.h:75
void set_coeff(int i, double q)
Set coefficient as demanded by base class.
Definition: ldpk_classic_3de_mixed_distortion.h:51
vec2_type eval(const vec2_type &p) const
Same as method instead of operator.
Definition: ldpk_generic_distortion_base.h:77
virtual bool distort(double x0, double y0, double x1_start, double y1_start, double &x1, double &y1)
potentially more efficient function which uses initial values...
Definition: tde4_ldp_classic_3de_mixed.h:110
Degree-2 anamorphic and degree-4 radial mixed model.
bool getParameterName(int i, char *identifier)
returns "identifier" name of parameter "i" (maximum length of "identifier": 100 bytes)...
Definition: tde4_ldp_classic_3de_mixed.h:50
Degree-2 anamorphic and degree-4 radial mixed model. Does not compensate for decentering. Parameters can be calculated by 3DE's Matrix Tool.
Definition: tde4_ldp_classic_3de_mixed.h:14
bool getParameterRange(const char *identifier, double &a, double &b)
returns range for adjustable double parameters...
Definition: tde4_ldp_classic_3de_mixed.h:151
bool getParameterDefaultValue(const char *identifier, double &v)
returns default value for given parameter (maximum length of "char *v": 1000 bytes)......
Definition: tde4_ldp_classic_3de_mixed.h:142
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_classic_3de_mixed.h:55
double get_coeff(int i) const
Get coefficient as demanded by base class.
Definition: ldpk_classic_3de_mixed_distortion.h:48
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_classic_3de_mixed_distortion.h:70
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_classic_3de_mixed.h:124
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 initializeParameters()
prepare the current set of parameters...
Definition: tde4_ldp_classic_3de_mixed.h:39
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:95
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_classic_3de_mixed.h:133