lensfun: lfLens Struct Reference

lensfun 0.3.1.0

- Main Page
- Related Pages
- Modules
- Classes
- Files
- Examples

- Class List
- Class Members

Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
lfLens Struct Reference
Structures and functions for lenses

Lens data. Unknown fields are set to NULL or 0. More...

`#include <lensfun.h>`

## Public Member Functions
| lfLens ()
| Create a new lens object, initializing all fields to default values.
| lfLens (const lfLens &other)
| ~lfLens ()
| Destroy this and all associated objects.
lfLens & | operator= (const lfLens &other)
void | SetMaker (const char *val, const char *lang=NULL)
| Add a string to camera maker. More...
void | SetModel (const char *val, const char *lang=NULL)
| Add a string to camera model. More...
void | AddMount (const char *val)
| Add a new mount type to this lens. More...
void | AddCalibDistortion (const lfLensCalibDistortion *dc)
| Add a new distortion calibration structure to the pool. More...
bool | RemoveCalibDistortion (int idx)
| Remove a calibration entry from the distortion calibration data. More...
void | AddCalibTCA (const lfLensCalibTCA *tcac)
| Add a new transversal chromatic aberration calibration structure to the pool. More...
bool | RemoveCalibTCA (int idx)
| Remove a calibration entry from the TCA calibration data. More...
void | AddCalibVignetting (const lfLensCalibVignetting *vc)
| Add a new vignetting calibration structure to the pool. More...
bool | RemoveCalibVignetting (int idx)
| Remove a calibration entry from the vignetting calibration data. More...
void | AddCalibCrop (const lfLensCalibCrop *cc)
| Add a new lens crop structure to the pool. More...
bool | RemoveCalibCrop (int idx)
| Remove a lens crop entry from the lens crop structure. More...
DEPRECATED void | AddCalibFov (const lfLensCalibFov *cf)
| Add a new lens fov structure to the pool. More...
DEPRECATED bool | RemoveCalibFov (int idx)
| Remove a field of view entry from the lens fov structure. More...
void | AddCalibRealFocal (const lfLensCalibRealFocal *cf)
| Add a new lens real focal length structure to the pool. More...
bool | RemoveCalibRealFocal (int idx)
| Remove a real focal length entry from the lens real focal length structure. More...
void | GuessParameters ()
| This method fills some fields if they are missing but can be derived from other fields. More...
bool | Check ()
| Check if a lens object is valid. More...
bool | InterpolateDistortion (float focal, lfLensCalibDistortion &res) const
| Interpolate lens geometry distortion data for given focal length. More...
bool | InterpolateTCA (float focal, lfLensCalibTCA &res) const
| Interpolate lens TCA calibration data for given focal length. More...
bool | InterpolateVignetting (float focal, float aperture, float distance, lfLensCalibVignetting &res) const
| Interpolate lens vignetting model parameters for given focal length, aperture, and focus distance. More...
bool | InterpolateCrop (float focal, lfLensCalibCrop &res) const
| Interpolate lens crop data for given focal length. More...
DEPRECATED bool | InterpolateFov (float focal, lfLensCalibFov &res) const
| Interpolate lens fov data for given focal length. More...
bool | InterpolateRealFocal (float focal, lfLensCalibRealFocal &res) const
| Interpolate lens real focal length data for given focal length. More...

## Static Public Member Functions
static const char * | GetDistortionModelDesc (lfDistortionModel model, const char **details, const lfParameter ***params)
| Get the human-readable distortion model name and the descriptions of the parameters required by this model. More...
static const char * | GetTCAModelDesc (lfTCAModel model, const char **details, const lfParameter ***params)
| Get the human-readable transversal chromatic aberrations model name and the descriptions of the parameters required by this model. More...
static const char * | GetVignettingModelDesc (lfVignettingModel model, const char **details, const lfParameter ***params)
| Get the human-readable vignetting model name and the descriptions of the parameters required by this model. More...
static const char * | GetCropDesc (lfCropMode mode, const char **details, const lfParameter ***params)
| Get the human-readable crop name and the descriptions of the parameters required by this model. More...
static const char * | GetLensTypeDesc (lfLensType type, const char **details)
| Get the human-readable lens type name and a short description of this lens type. More...

## Public Attributes
lfMLstr | Maker
lfMLstr | Model
float | MinFocal
float | MaxFocal
float | MinAperture
float | MaxAperture
char ** | Mounts
float | CenterX
float | CenterY
float | CropFactor
float | AspectRatio
lfLensType | Type
lfLensCalibDistortion ** | CalibDistortion
lfLensCalibTCA ** | CalibTCA
lfLensCalibVignetting ** | CalibVignetting
lfLensCalibCrop ** | CalibCrop
lfLensCalibFov ** | CalibFov
lfLensCalibRealFocal ** | CalibRealFocal
int | Score

## Detailed Description

Lens data. Unknown fields are set to NULL or 0.

To create a new lens object, use the lfLens::Create() or lf_lens_new() functions. After that fill the fields for which you have data, and invoke the lfLens::Check or lf_lens_check() function, which will check if existing data is enough and will fill some fields using information extracted from lens name.

Examples:
  example.c, lenstool.cpp, and tfun.cpp.

## Constructor & Destructor Documentation

lfLens::lfLens | ( | const lfLens & | other | ) |

Copy constructor.

## Member Function Documentation

void lfLens::AddCalibCrop | ( | const lfLensCalibCrop * | cc | ) |

Add a new lens crop structure to the pool.

The objects is copied, thus you can reuse it as soon as this function returns.

Parameters

  cc | The lens crop structure.

void lfLens::AddCalibDistortion | ( | const lfLensCalibDistortion * | dc | ) |

Add a new distortion calibration structure to the pool.

The objects is copied, thus you can reuse it as soon as this function returns.

Parameters

  dc | The distortion calibration structure.

DEPRECATED void lfLens::AddCalibFov | ( | const lfLensCalibFov * | cf | ) |

Add a new lens fov structure to the pool.

The Field of View (FOV) database entry is deprecated since lensfun version 0.3 and will be removed in future releases.

The objects is copied, thus you can reuse it as soon as this function returns.

Parameters

  cf | The lens fov structure.

void lfLens::AddCalibRealFocal | ( | const lfLensCalibRealFocal * | cf | ) |

Add a new lens real focal length structure to the pool.

The objects is copied, thus you can reuse it as soon as this function returns.

Parameters

  cf | The lens real focal length structure.

void lfLens::AddCalibTCA | ( | const lfLensCalibTCA * | tcac | ) |

Add a new transversal chromatic aberration calibration structure to the pool.

The objects is copied, thus you can reuse it as soon as this function returns.

Parameters

  tcac | The transversal chromatic aberration calibration structure.

void lfLens::AddCalibVignetting | ( | const lfLensCalibVignetting * | vc | ) |

Add a new vignetting calibration structure to the pool.

The objects is copied, thus you can reuse it as soon as this function returns.

Parameters

  vc | The vignetting calibration structure.

void lfLens::AddMount | ( | const char * | val | ) |

Add a new mount type to this lens.

This is not a multi-language string, this it's just plain replaced.

Parameters

  val | The new value to add to the Mounts array.

bool lfLens::Check | ( |  | ) |

Check if a lens object is valid.

Returns
  true if the required fields are ok.

static const char* lfLens::GetCropDesc | ( | lfCropMode | mode,
|  | const char ** | details,
|  | const lfParameter *** | params
| ) |  |
| static

Get the human-readable crop name and the descriptions of the parameters required by this model.

Parameters

  mode | The crop mode.
  details | If not NULL, this string will be set to a more detailed (technical) description of the model. This string may contain newlines.
  params | If not NULL, this variable will be set to a pointer to an array of lfParameter structures, every structure describes a model parameter. The list is NULL-terminated.

Returns
  A short name of the distortion model or NULL if model is unknown.

static const char* lfLens::GetDistortionModelDesc | ( | lfDistortionModel | model,
|  | const char ** | details,
|  | const lfParameter *** | params
| ) |  |
| static

Get the human-readable distortion model name and the descriptions of the parameters required by this model.

Parameters

  model | The model.
  details | If not NULL, this string will be set to a more detailed (technical) description of the model. This string may contain newlines.
  params | If not NULL, this variable will be set to a pointer to an array of lfParameter structures, every structure describes a model parameter. The list is NULL-terminated.

Returns
  A short name of the distortion model or NULL if model is unknown.

static const char* lfLens::GetLensTypeDesc | ( | lfLensType | type,
|  | const char ** | details
| ) |  |
| static

Get the human-readable lens type name and a short description of this lens type.

Parameters

  type | Lens type.
  details | If not NULL, this string will be set to a more detailed (technical) description of the lens type. This string may contain newlines.

Returns
  A short name of the lens type or NULL if model is unknown.

static const char* lfLens::GetTCAModelDesc | ( | lfTCAModel | model,
|  | const char ** | details,
|  | const lfParameter *** | params
| ) |  |
| static

Get the human-readable transversal chromatic aberrations model name and the descriptions of the parameters required by this model.

Parameters

  model | The model.
  details | If not NULL, this string will be set to a more detailed (technical) description of the model. This string may contain newlines.
  params | If not NULL, this variable will be set to a pointer to an array of lfParameter structures, every structure describes a model parameter. The list is NULL-terminated.

Returns
  A short name of the TCA model or NULL if model is unknown.

static const char* lfLens::GetVignettingModelDesc | ( | lfVignettingModel | model,
|  | const char ** | details,
|  | const lfParameter *** | params
| ) |  |
| static

Get the human-readable vignetting model name and the descriptions of the parameters required by this model.

Parameters

  model | The model.
  details | If not NULL, this string will be set to a more detailed (technical) description of the model. This string may contain newlines.
  params | If not NULL, this variable will be set to a pointer to an array of lfParameter structures, every structure describes a model parameter. The list is NULL-terminated.

Returns
  A short name of the vignetting model or NULL if model is unknown.

void lfLens::GuessParameters | ( |  | ) |

This method fills some fields if they are missing but can be derived from other fields.

This includes such non-obvious parameters like the range of focal lengths or the range of apertures, which can be derived from lens named (which is intelligently parsed) or from the list of calibrations.

bool lfLens::InterpolateCrop | ( | float | focal,
|  | lfLensCalibCrop & | res
| ) |  | const

Interpolate lens crop data for given focal length.

Parameters

  focal | The focal length in mm at which we need image parameters.
  res | The resulting interpolated information data.

bool lfLens::InterpolateDistortion | ( | float | focal,
|  | lfLensCalibDistortion & | res
| ) |  | const

Interpolate lens geometry distortion data for given focal length.

Parameters

  focal | The focal length in mm at which we need geometry distortion parameters.
  res | The resulting interpolated model.

DEPRECATED bool lfLens::InterpolateFov | ( | float | focal,
|  | lfLensCalibFov & | res
| ) |  | const

Interpolate lens fov data for given focal length.

The Field of View (FOV) database entry is deprecated since lensfun version 0.3 and will be removed in future releases.

Parameters

  focal | The focal length in mm at which we need image parameters.
  res | The resulting interpolated information data.

bool lfLens::InterpolateRealFocal | ( | float | focal,
|  | lfLensCalibRealFocal & | res
| ) |  | const

Interpolate lens real focal length data for given focal length.

The Field of View (FOV) database entry is deprecated since lensfun version 0.3 and will be removed in future releases.

Parameters

  focal | The nominal focal length in mm at which we need image parameters.
  res | The resulting interpolated information data.

bool lfLens::InterpolateTCA | ( | float | focal,
|  | lfLensCalibTCA & | res
| ) |  | const

Interpolate lens TCA calibration data for given focal length.

Parameters

  focal | The focal length in mm at which we need TCA parameters.
  res | The resulting interpolated model.

bool lfLens::InterpolateVignetting | ( | float | focal,
|  | float | aperture,
|  | float | distance,
|  | lfLensCalibVignetting & | res
| ) |  | const

Interpolate lens vignetting model parameters for given focal length, aperture, and focus distance.

Parameters

  focal | The focal length in mm for which we need vignetting parameters.
  aperture | The aperture (f-number) for which we need vignetting parameters.
  distance | The focus distance in meters (distance > 0) for which we need vignetting parameters.
  res | The resulting interpolated model.

lfLens& lfLens::operator= | ( | const lfLens & | other | ) |

Assignment operator

bool lfLens::RemoveCalibCrop | ( | int | idx | ) |

Remove a lens crop entry from the lens crop structure.

Parameters

  idx | The lens crop data index (zero-based).

bool lfLens::RemoveCalibDistortion | ( | int | idx | ) |

Remove a calibration entry from the distortion calibration data.

Parameters

  idx | The calibration data index (zero-based).

DEPRECATED bool lfLens::RemoveCalibFov | ( | int | idx | ) |

Remove a field of view entry from the lens fov structure.

The Field of View (FOV) database entry is deprecated since lensfun version 0.3 and will be removed in future releases.

Parameters

  idx | The lens information data index (zero-based).

bool lfLens::RemoveCalibRealFocal | ( | int | idx | ) |

Remove a real focal length entry from the lens real focal length structure.

Parameters

  idx | The lens information data index (zero-based).

bool lfLens::RemoveCalibTCA | ( | int | idx | ) |

Remove a calibration entry from the TCA calibration data.

Parameters

  idx | The calibration data index (zero-based).

bool lfLens::RemoveCalibVignetting | ( | int | idx | ) |

Remove a calibration entry from the vignetting calibration data.

Parameters

  idx | The calibration data index (zero-based).

void lfLens::SetMaker | ( | const char * | val,
|  | const char * | lang = `NULL`
| ) |  |

Add a string to camera maker.

If lang is NULL, this replaces the default value, otherwise a new language value is appended.

Parameters

  val | The new value for the Maker field.
  lang | The language this field is in.

void lfLens::SetModel | ( | const char * | val,
|  | const char * | lang = `NULL`
| ) |  |

Add a string to camera model.

If lang is NULL, this replaces the default value, otherwise a new language value is appended.

Parameters

  val | The new value for the Model field.
  lang | The language this field is in.

## Member Data Documentation

float lfLens::AspectRatio

Aspect ratio of the images used for calibration measurements.

Examples:
  tfun.cpp.

lfLensCalibCrop** lfLens::CalibCrop

Crop data, NULL-terminated (unsorted)

lfLensCalibDistortion** lfLens::CalibDistortion

Lens distortion calibration data, NULL-terminated (unsorted)

lfLensCalibFov** lfLens::CalibFov

Field of view calibration data, NULL-terminated (unsorted)

lfLensCalibRealFocal** lfLens::CalibRealFocal

Real focal length calibration data, NULL-terminated (unsorted)

lfLensCalibTCA** lfLens::CalibTCA

Lens TCA calibration data, NULL-terminated (unsorted)

lfLensCalibVignetting** lfLens::CalibVignetting

Lens vignetting calibration data, NULL-terminated (unsorted)

float lfLens::CenterX

The horizontal shift of all lens distortions. Note that distortion and TCA uses same geometrical lens center. It is given as a relative value to avoide dependency on the image and/or sensor sizes. The calibrated delta X and Y values are numbers in the -0.5 .. +0.5 range. For 1 we take the maximal image dimension (width or height) - this is related to the fact that the lens has a circular field of projection disregarding sensor size.

Examples:
  tfun.cpp.

float lfLens::CenterY

The vertical shift of all lens distortions. (0,0) for geometric center

Examples:
  tfun.cpp.

float lfLens::CropFactor

Crop factor at which calibration measurements were taken. Must be defined.

Examples:
  lenstool.cpp, and tfun.cpp.

lfMLstr lfLens::Maker

Lens maker (ex: "Rollei")

Examples:
  tfun.cpp.

float lfLens::MaxAperture

Biggest f-number possible (ex: 22). Can be equal to MinAperture.

Examples:
  tfun.cpp.

float lfLens::MaxFocal

Maximum focal length, mm (ex: 105). Can be equal to MinFocal.

Examples:
  tfun.cpp.

float lfLens::MinAperture

Smallest f-number possible (ex: 3.5).

Examples:
  lenstool.cpp, and tfun.cpp.

float lfLens::MinFocal

Minimum focal length, mm (ex: 35).

Examples:
  lenstool.cpp, and tfun.cpp.

lfMLstr lfLens::Model

Lens model (ex: "Zoom-Rolleinar")

Examples:
  lenstool.cpp, and tfun.cpp.

char** lfLens::Mounts

Available mounts (NULL-terminated list) (ex: { "QBM", NULL })

Examples:
  example.c, and tfun.cpp.

int lfLens::Score

Lens matching score, used while searching: not actually a lens parameter

lfLensType lfLens::Type

Lens type

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

- lensfun.h