ARX  1.0
The next-generation open source augmented reality toolkit.
Loading...
Searching...
No Matches
Macros | Functions
paramDistortion.c File Reference
#include <stdio.h>
#include <math.h>
#include <ARX/AR/ar.h>
Include dependency graph for paramDistortion.c:

Macros

#define PD_LOOP   3
 
#define PD_LOOP2   5
 
#define SQRT   sqrt
 

Functions

int arParamObserv2Ideal (const ARdouble dist_factor[AR_DIST_FACTOR_NUM_MAX], const ARdouble ox, const ARdouble oy, ARdouble *ix, ARdouble *iy, const int dist_function_version)
 Use lens distortion parameters to convert observed (distorted) window coordinates to idealised (zero-distortion) coordinates. More...
 
int arParamIdeal2Observ (const ARdouble dist_factor[AR_DIST_FACTOR_NUM_MAX], const ARdouble ix, const ARdouble iy, ARdouble *ox, ARdouble *oy, const int dist_function_version)
 Use lens distortion parameters to convert idealised (zero-distortion) window coordinates to observed (distorted) coordinates. More...
 

Macro Definition Documentation

◆ PD_LOOP

#define PD_LOOP   3

◆ PD_LOOP2

#define PD_LOOP2   5

◆ SQRT

#define SQRT   sqrt

Function Documentation

◆ arParamIdeal2Observ()

int arParamIdeal2Observ ( const ARdouble  dist_factor[AR_DIST_FACTOR_NUM_MAX],
const ARdouble  ix,
const ARdouble  iy,
ARdouble ox,
ARdouble oy,
const int  dist_function_version 
)

Use lens distortion parameters to convert idealised (zero-distortion) window coordinates to observed (distorted) coordinates.

See function arParamObserv2Ideal() for full discussion.

This function is the output function of the pair. It's inputs are idealised coordinates, e.g. taken from OpenGL. The outputs are the location where in a distorted image where the same point would lie.

Parameters
dist_factorAn array of ARdouble values holding the lens distortion parameters. These values are generated as part of the camera calibration process in artoolkitX. The exact number of values from the array used by the function is determined by the distortion function version, but does not exceed AR_DIST_FACTOR_NUM_MAX.
ixInput idealised normalised window coordinate x axis value.
iyInput idealised normalised window coordinate y axis value.
oxPointer to ARdouble, which on return will hold the observed normalised window coordinate x axis value.
oyPointer to ARdouble, which on return will hold the observed normalised window coordinate y axis value.
dist_function_versionAn integer, in the range [1, AR_DIST_FUNCTION_VERSION_MAX] which determines the algorithm used to interpret the dist_factor values.

See function arParamObserv2Ideal() for full discussion.

Returns
0 in case of function success, or -1 if an error occured. At present the only error possible is an invalid value of dist_function_version.
See also
arParamObserv2Ideal
arParamObserv2IdealLTf

◆ arParamObserv2Ideal()

int arParamObserv2Ideal ( const ARdouble  dist_factor[AR_DIST_FACTOR_NUM_MAX],
const ARdouble  ox,
const ARdouble  oy,
ARdouble ix,
ARdouble iy,
const int  dist_function_version 
)

Use lens distortion parameters to convert observed (distorted) window coordinates to idealised (zero-distortion) coordinates.

This function is used by artoolkitX to convert for the the effects of lens distortion in images which have been acquired from lens-based optical systems. All lenses introduce some amount of lens distortion. artoolkitX includes calibration utilities to measure the centre of distortion and the radial distortion factors in the x and y dimensions. This calibration information is saved as part of the camera parameters.

This function is one of a pair of functions which convert between OBSERVED window coordinates (i.e. the location of a known reference point, as measured in the x-y viewing plane of an image containing lens distortion) and IDEALISED coordinates (i.e. the location of the same reference point as measured in an image containing no radial distortion, e.g. an image rendered using OpenGL's viewing model.)

This function is the input function of the pair. It's inputs are distorted coordinates, e.g. taken from an image acquired from a camera The outputs are the location where in an idealised image (e.g. generated with OpenGL) where the same point would lie.

Parameters
dist_factorAn array of ARdouble values holding the lens distortion parameters. These values are generated as part of the camera calibration process in artoolkitX. The exact number of values from the array used by the function is determined by the distortion function version, but does not exceed AR_DIST_FACTOR_NUM_MAX.
ixInput observed normalised window coordinate x axis value.
iyInput observed normalised window coordinate y axis value.
oxPointer to ARdouble, which on return will hold the idealised normalised window coordinate x axis value.
oyPointer to ARdouble, which on return will hold the idealised normalised window coordinate y axis value.
dist_function_versionAn integer, in the range [1, AR_DIST_FUNCTION_VERSION_MAX] which determines the algorithm used to interpret the dist_factor values.

The values correspond to the following algorithms:

version 1: The original ARToolKit lens model, with a single radial distortion factor, plus center of distortion.
version 2: Improved distortion model, introduced in ARToolKit v4.0. This algorithm adds a quadratic term to the radial distortion factor of the version 1 algorithm.
version 3: Improved distortion model with aspect ratio, introduced in ARToolKit v4.0. The addition of an aspect ratio to the version 2 algorithm allows for non-square pixels, as found e.g. in DV image streams.
version 4: OpenCV-based distortion model, introduced in ARToolKit v4.3. This differs from the standard OpenCV model by the addition of a scale factor, so that input values do not exceed the range [-1.0, 1.0] in either forward or inverse conversions.

Returns
0 in case of function success, or -1 if an error occured. At present the only error possible is an invalid value of dist_function_version.
See also
arParamIdeal2Observ
arParamIdeal2ObservLTf