ldpk
Protected Member Functions | Protected Attributes | List of all members
ldpk::ldp_builtin< VEC2, MAT2 > Class Template Reference

This class handles the built-in parameter and the lookup table. You may find it useful for your own distortion model, since it implements the built-in parameters and the lookup table mechanism. But in contrast to tde4_ld_plugin it's not stringent to use it from a technical point of view. Alternatively you can implement all this in your plugin class. More...

#include <ldpk_ldp_builtin.h>

Inheritance diagram for ldpk::ldp_builtin< VEC2, MAT2 >:
Inheritance graph
[legend]
Collaboration diagram for ldpk::ldp_builtin< VEC2, MAT2 >:
Collaboration graph
[legend]

Public Member Functions

Filmback, Lens Center Offset, Focal Length and Pixel Aspect.

I prefer short names that look like variable names in the documentation.

double w_fb_cm () const
 
double h_fb_cm () const
 
double x_lco_cm () const
 
double y_lco_cm () const
 
double fl_cm () const
 
double pa () const
 
double fd_cm () const
 
double r_fb_cm () const
 
virtual bool undistort_gnomonic (double x0, double y0, double &x1, double &y1)
 Model function Our base class presents the model functions along with the projection. Internally, we have to carefully keep apart the model function and the projection. For most distortion models, this is no problem, yet for fisheye models it is, so all non-gnomonic distortion classes will have to overwrite these.
 
virtual bool distort_gnomonic (double x0, double y0, double &x1, double &y1)
 
virtual bool distort_gnomonic (double x0, double y0, double x1_start, double y1_start, double &x1, double &y1)
 
virtual void getBoundingBoxUndistort (double xa_in, double ya_in, double xb_in, double yb_in, double &xa_out, double &ya_out, double &xb_out, double &yb_out, int nx, int ny)
 Bounding box.
 
virtual void getBoundingBoxDistort (double xa_in, double ya_in, double xb_in, double yb_in, double &xa_out, double &ya_out, double &xb_out, double &yb_out, int nx, int ny)
 Iterate around the specified box, distort the points and compute the bounding box.
 
- Public Member Functions inherited from tde4_ld_plugin
const char * getVersionString () const
 
virtual bool getModelName (char *model)=0
 returns a name for the model as to show up in the GUI (maximum length of "name": 100 bytes)...
 
virtual bool getNumParameters (int &n)=0
 returns the number of plugin parameters...
 
virtual bool getParameterName (int i, char *identifier)=0
 returns "identifier" name of parameter "i" (maximum length of "identifier": 100 bytes)...
 
virtual bool getParameterType (const char *identifier, tde4_ldp_ptype &type)=0
 returns type of given parameter... The method should return false, if the parameter addressed by identifier does not exist.
 
virtual bool getParameterDefaultValue (const char *identifier, double &v)=0
 returns default value for given parameter (maximum length of "char *v": 1000 bytes)......
 
virtual bool getParameterDefaultValue (const char *identifier, char *v)
 
virtual bool getParameterDefaultValue (const char *identifier, int &v)
 
virtual bool getParameterDefaultValue (const char *identifier, bool &v)
 
virtual bool getParameterRange (const char *identifier, double &a, double &b)=0
 returns range for adjustable double parameters...
 
virtual bool setParameterValue (const char *identifier, double v)=0
 set parameter values... parameters predefined by 3DE4: "tde4_focal_length_cm", "tde4_filmback_width_cm", "tde4_filmback_height_cm", "tde4_lens_center_offset_x_cm", "tde4_lens_center_offset_y_cm", "tde4_pixel_aspect", "tde4_custom_focus_distance_cm"
 
virtual bool setParameterValue (const char *identifier, const char *v)
 
virtual bool setParameterValue (const char *identifier, int v)
 
virtual bool setParameterValue (const char *identifier, bool v)
 
virtual bool initializeParameters ()=0
 prepare the current set of parameters...
 
virtual bool undistort (double x0, double y0, double &x1, double &y1)=0
 warp/unwarp 2D points...
 
virtual bool distort (double x0, double y0, double &x1, double &y1)=0
 
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...
 
virtual bool providesParameterDerivatives ()
 parameter derivatives to be used for distortion grid controls' matrix calculation routine...
 
virtual bool calcParameterDerivatives (double x, double y, int num_parameters, double *dx_dy)
 dx_dy is an array with 2 * num_parameters elements (x- and y- component for each of n derivatives)
 
virtual bool getJacobianMatrixDQ (double x0, double y0, double &m00, double &m01, double &m10, double &m11)
 calculate the Jacobian matrix of the undistort()-Method by means of difference quotients. This is the default implementation. Also use it for testing your own implementation of getJacobianMatrix(). The model function is evaluated at four points forming a little cross. If any of these evaluations fail (e.g. domain error), the method returns false, else true.
 
virtual 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 your own lens distortion model.
 
virtual bool getTwistVectorDQ (double x0, double y0, double &t0, double &t1)
 calculate the mixed derivatives ("twist vector") of the undistort()-Method. Overwrite this, if you know the twist vector for your own lens distortion model. The model function is evaluated at four points forming a little rectangle. If any of these evaluations fail (e.g. domain error), the method returns false, else true.
 
virtual bool getTwistVector (double x0, double y0, double &t0, double &t1)
 

Protected Member Functions

vec2_type map_unit_to_dn (const vec2_type &p_unit) const
 
vec2_type map_dn_to_unit (const vec2_type &p_dn) const
 
void lock ()
 
void unlock ()
 
Lookup table methods

checking up-to-date status, declaring obsolete, updating, constant access

bool is_uptodate_lut () const
 The derived class uses this in order to check if the lookup table needs an update.
 
void no_longer_uptodate_lut ()
 This class and the derived class mark the lookup table as obsolete when some parameter was changed.
 
void set_uptodate_lut (bool u)
 If a derived class computes the LUT, it must have write-access to this flag.
 
virtual void update_lut ()
 Update the lookup table. The derived class will do this, if necessary, when distort() without initial value is invoked.
 
const ldpk::lookup_table< vec2_type > & get_lut () const
 The derived class has constant access, since it needs to consult it.
 
Built-in parameters
int get_num_builtin_parameters () const
 There are seven built-in parameters.
 
bool set_builtin_parameter_value (const char *identifier, double v)
 The return values indicates, if 'identifier' refers to a built-in parameter.
 
bool get_builtin_parameter_type (const char *identifier, tde4_ldp_ptype &ptype) const
 The return values indicates, if 'identifier' refers to a built-in parameter. Currently, all built-in parameters are double-valued.
 
void check_builtin_parameters ()
 This method should be invoked by the derived classes in initializeParameters(). It write error messages to stderr if parameters are not initialized properly. We check filmback width, filmback height, focal length and pixel aspect. Focus distance is not checked currently.
 

Protected Attributes

CRITICAL_SECTION _critsec
 The Mutex, used in derived classes, initialized in constructor.
 
pthread_mutex_t _mutex
 

Detailed Description

template<class VEC2, class MAT2>
class ldpk::ldp_builtin< VEC2, MAT2 >

This class handles the built-in parameter and the lookup table. You may find it useful for your own distortion model, since it implements the built-in parameters and the lookup table mechanism. But in contrast to tde4_ld_plugin it's not stringent to use it from a technical point of view. Alternatively you can implement all this in your plugin class.


The documentation for this class was generated from the following file: