lensfun: Structures and functions for lenses

Classes | Enumerations | Functions

# Structures and functions for lenses

These structures and functions allow to define and examine the properties of a lens. More...

## Classes
struct | lfLensCalibDistortion
| Lens distortion calibration data. More...
struct | lfLensCalibTCA
| Laterlal chromatic aberrations calibration data. More...
struct | lfLensCalibVignetting
| Lens vignetting calibration data. More...
struct | lfParameter
| This structure describes a single parameter for some lens model. More...
struct | lfLens
| Lens data. More...
## Enumerations
enum | lfDistortionModel { LF_DIST_MODEL_NONE, LF_DIST_MODEL_POLY3, LF_DIST_MODEL_POLY5, LF_DIST_MODEL_FOV1, LF_DIST_MODEL_PTLENS }
| The lensdb library implements several lens distortion models. More...
enum | lfTCAModel { LF_TCA_MODEL_NONE, LF_TCA_MODEL_LINEAR, LF_TCA_MODEL_POLY3 }
| The lensdb library supports several models for lens lateral chromatic aberrations (also called transversal chromatic aberrations, TCA). More...
enum | lfVignettingModel { LF_VIGNETTING_MODEL_NONE, LF_VIGNETTING_MODEL_PA }
| The lensdb library supports several models for lens vignetting correction. More...
enum | lfLensType { LF_UNKNOWN, LF_RECTILINEAR, LF_FISHEYE, LF_PANORAMIC, LF_EQUIRECTANGULAR }
| Lens type. More...
## Functions
lfLens * | lf_lens_new ()
| Create a new lens object.
void | lf_lens_destroy (lfLens *lens)
| Destroy a lfLens object.
void | lf_lens_copy (lfLens *dest, const lfLens *source)
| Copy the data from one lfLens structure into another.
cbool | lf_lens_check (lfLens *lens)
void | lf_lens_guess_parameters (lfLens *lens)
const char * | lf_get_distortion_model_desc (enum lfDistortionModel model, const char **details, const lfParameter ***params)
const char * | lf_get_tca_model_desc (enum lfTCAModel model, const char **details, const lfParameter ***params)
const char * | lf_get_vignetting_model_desc (enum lfVignettingModel model, const char **details, const lfParameter ***params)
const char * | lf_get_lens_type_desc (enum lfLensType type, const char **details)
cbool | lf_lens_interpolate_distortion (const lfLens *lens, float focal, lfLensCalibDistortion *res)
cbool | lf_lens_interpolate_tca (const lfLens *lens, float focal, lfLensCalibTCA *res)
cbool | lf_lens_interpolate_vignetting (const lfLens *lens, float focal, float aperture, float distance, lfLensCalibVignetting *res)
void | lf_lens_add_calib_distortion (lfLens *lens, const lfLensCalibDistortion *dc)
cbool | lf_lens_remove_calib_distortion (lfLens *lens, int idx)
void | lf_lens_add_calib_tca (lfLens *lens, const lfLensCalibTCA *tcac)
cbool | lf_lens_remove_calib_tca (lfLens *lens, int idx)
void | lf_lens_add_calib_vignetting (lfLens *lens, const lfLensCalibVignetting *vc)
cbool | lf_lens_remove_calib_vignetting (lfLens *lens, int idx)

## Detailed Description

These structures and functions allow to define and examine the properties of a lens.

## Enumeration Type Documentation

enum lfDistortionModel

The lensdb library implements several lens distortion models.

This enum lists them. Distortion usually heavily depends on the focal distance, but does not depend on the aperture.

For a popular explanation of lens distortion see http://www.vanwalree.com/optics/distortion.html

Enumerator:

  LF_DIST_MODEL_NONE | Distortion parameters are unknown.
  LF_DIST_MODEL_POLY3 | 3rd order polynomial model: Ru = Rd * (1 + k1 * Rd^2) Ref: http://www.imatest.com/docs/distortion.html
  LF_DIST_MODEL_POLY5 | 5th order polynomial model: Ru = Rd * (1 + k1 * Rd^2 + k2 * Rd^4)
  LF_DIST_MODEL_FOV1 | Field-of-view lens model: Ru = tg (Rd * omega) / (2 * tg (omega/2)) Ref: ftp://ftp-sop.inria.fr/chir/publis/devernay-faugeras:01.pdf.
  LF_DIST_MODEL_PTLENS | PTLens rectilinear: Ru = Rd * (a * Rd^3 + b * Rd^2 + c * Rd + 1)

enum lfLensType

Lens type.

Enumerator:

  LF_UNKNOWN | Unknown lens type.
  LF_RECTILINEAR | A rectilinear lens - 99% of all lenses are of this type.
  LF_FISHEYE | Fisheye lens Ref: http://wiki.panotools.org/Fisheye_Projection.
  LF_PANORAMIC | Panoramic (cylindrical)
  LF_EQUIRECTANGULAR | Equirectangular (not that there are such lenses, but useful to convert images TO this type, especially fish-eye images.

enum lfTCAModel

The lensdb library supports several models for lens lateral chromatic aberrations (also called transversal chromatic aberrations, TCA).

TCAs depend on focal distance, but does not depend of the aperture.

For a popular explanation of chromatic aberrations see http://www.vanwalree.com/optics/chromatic.html

Enumerator:

  LF_TCA_MODEL_NONE | No TCA correction data is known.
  LF_TCA_MODEL_LINEAR | Linear lateral chromatic aberrations model: Cd(R) = Cs(R) * kr Cd(B) = Cs(B) * kb Ref: http://cipa.icomos.org/fileadmin/papers/Torino2005/403.pdf.
  LF_TCA_MODEL_POLY3 | Third order polynomial: Cd(R) = Cs(R)^3 * br + Cs(R)^2 * cr + Cs(R) * vr Cd(B) = Cs(B)^3 * bb + Cs(B)^2 * cb + Cs(B) * vb Ref: http://wiki.panotools.org/Tca_correct.

enum lfVignettingModel

The lensdb library supports several models for lens vignetting correction.

We focus on optical and natural vignetting since they can be generalized for all lenses of a certain type; mechanical vignetting is out of the scope of this library.

Vignetting is dependent on both focal distance and aperture.

For a popular explanation of vignetting see http://www.vanwalree.com/optics/vignetting.html

Enumerator:

  LF_VIGNETTING_MODEL_NONE | No vignetting correction data is known.
  LF_VIGNETTING_MODEL_PA | Pablo D'Angelo vignetting model (which is a more general variant of the cos^4 law): Cd = Cs * (1 + k1 * R^2 + k2 * R^4 + k3 * R^6) Ref: http://hugin.sourceforge.net/tech/.

## Function Documentation

const char* lf_get_distortion_model_desc | ( | enum lfDistortionModel | model,
|  | const char ** | details,
|  | const lfParameter *** | params
| ) |  |

See also:
  lfLens::GetDistortionModelDesc

const char* lf_get_lens_type_desc | ( | enum lfLensType | type,
|  | const char ** | details
| ) |  |

See also:
  lfLens::GetLensTypeDesc

const char* lf_get_tca_model_desc | ( | enum lfTCAModel | model,
|  | const char ** | details,
|  | const lfParameter *** | params
| ) |  |

See also:
  lfLens::GetTCAModelDesc

const char* lf_get_vignetting_model_desc | ( | enum lfVignettingModel | model,
|  | const char ** | details,
|  | const lfParameter *** | params
| ) |  |

See also:
  lfLens::GetVignettingModelDesc

void lf_lens_add_calib_distortion | ( | lfLens * | lens,
|  | const lfLensCalibDistortion * | dc
| ) |  |

See also:
  lfLens::AddCalibDistortion

void lf_lens_add_calib_tca | ( | lfLens * | lens,
|  | const lfLensCalibTCA * | tcac
| ) |  |

See also:
  lfLens::AddCalibTCA

void lf_lens_add_calib_vignetting | ( | lfLens * | lens,
|  | const lfLensCalibVignetting * | vc
| ) |  |

See also:
  lfLens::AddCalibVignetting

cbool lf_lens_check | ( | lfLens * | lens ) |

See also:
  lfLens::Check

void lf_lens_copy | ( | lfLens * | dest,
|  | const lfLens * | source
| ) |  |

Copy the data from one lfLens structure into another.

Parameters:

  dest | The destination object
  source | The source object

See also:
  lfLens::operator = (const lfCamera &)

void lf_lens_destroy | ( | lfLens * | lens ) |

Destroy a lfLens object.

This is equivalent to C++ "delete lens".

Parameters:

  lens | The lens object to destroy.

See also:
  lfLens::~lfLens

void lf_lens_guess_parameters | ( | lfLens * | lens ) |

See also:
  lfLens::GuessParameters

cbool lf_lens_interpolate_distortion | ( | const lfLens * | lens,
|  | float | focal,
|  | lfLensCalibDistortion * | res
| ) |  |

See also:
  lfLens::InterpolateDistortion

cbool lf_lens_interpolate_tca | ( | const lfLens * | lens,
|  | float | focal,
|  | lfLensCalibTCA * | res
| ) |  |

See also:
  lfLens::InterpolateTCA

cbool lf_lens_interpolate_vignetting | ( | const lfLens * | lens,
|  | float | focal,
|  | float | aperture,
|  | float | distance,
|  | lfLensCalibVignetting * | res
| ) |  |

See also:
  lfLens::InterpolateVignetting

lfLens* lf_lens_new | ( | ) |

Create a new lens object.

Returns:
  A new empty lens object.

See also:
  lfLens::lfLens

cbool lf_lens_remove_calib_distortion | ( | lfLens * | lens,
|  | int | idx
| ) |  |

See also:
  lfLens::RemoveCalibDistortion

cbool lf_lens_remove_calib_tca | ( | lfLens * | lens,
|  | int | idx
| ) |  |

See also:
  lfLens::RemoveCalibTCA

cbool lf_lens_remove_calib_vignetting | ( | lfLens * | lens,
|  | int | idx
| ) |  |

See also:
  lfLens::RemoveCalibVignetting