lensfun  0.3.99.0
Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members

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.
 
lfLensoperator= (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 *lcd)
 Add a new distortion calibration structure to the pool. More...
 
void AddCalibTCA (const lfLensCalibTCA *lctca)
 Add a new transversal chromatic aberration calibration structure to the pool. More...
 
void AddCalibVignetting (const lfLensCalibVignetting *lcv)
 Add a new vignetting calibration structure to the pool. More...
 
void AddCalibCrop (const lfLensCalibCrop *lcc)
 Add a new lens crop structure to the pool. More...
 
DEPRECATED void AddCalibFov (const lfLensCalibFov *lcf)
 Add a new lens fov structure to the pool. More...
 
void RemoveCalibrations ()
 Remove all calibrations from the lens.
 
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 crop, float focal, lfLensCalibDistortion &res) const
 Interpolate lens geometry distortion data for given focal length and crop factor. More...
 
bool InterpolateTCA (float crop, float focal, lfLensCalibTCA &res) const
 Interpolate lens TCA calibration data for given focal length. More...
 
bool InterpolateVignetting (float crop, 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 crop, float focal, lfLensCalibCrop &res) const
 Interpolate lens crop data for given focal length. More...
 
int AvailableModifications (float crop) const
 Get a flag with the available modifications for this lens considering the image crop factor. More...
 
const lfLensCalibrationSet *const * GetCalibrationSets () const
 Get a list of all calibration sets. More...
 
const char *const * GetMountNames () const
 Get a list of all mount names. 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
 
DEPRECATED char ** Mounts
 
lfLensType Type
 
float CenterX
 
float CenterY
 
DEPRECATED float CropFactor
 
DEPRECATED float AspectRatio
 
DEPRECATED lfLensCalibDistortion ** CalibDistortion
 
DEPRECATED lfLensCalibTCA ** CalibTCA
 
DEPRECATED lfLensCalibVignetting ** CalibVignetting
 
DEPRECATED lfLensCalibCrop ** CalibCrop
 
DEPRECATED lfLensCalibFov ** CalibFov
 
int Score
 

Friends

struct lfDatabase
 

Detailed Description

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

To manually create a new lens object, 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 automatically fill some fields using information extracted from lens name.

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

Constructor & Destructor Documentation

◆ lfLens()

lfLens::lfLens ( const lfLens other)

Copy constructor.

Member Function Documentation

◆ AddCalibCrop()

void lfLens::AddCalibCrop ( const lfLensCalibCrop lcc)

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
lccThe lens crop structure.

◆ AddCalibDistortion()

void lfLens::AddCalibDistortion ( const lfLensCalibDistortion lcd)

Add a new distortion calibration structure to the pool.

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

Parameters
lcdThe distortion calibration structure.

◆ AddCalibFov()

DEPRECATED void lfLens::AddCalibFov ( const lfLensCalibFov lcf)

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
lcfThe lens fov structure.

◆ AddCalibTCA()

void lfLens::AddCalibTCA ( const lfLensCalibTCA lctca)

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
lctcaThe transversal chromatic aberration calibration structure.

◆ AddCalibVignetting()

void lfLens::AddCalibVignetting ( const lfLensCalibVignetting lcv)

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
lcvThe vignetting calibration structure.

◆ AddMount()

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
valThe new value to add to the Mounts array.

◆ AvailableModifications()

int lfLens::AvailableModifications ( float  crop) const

Get a flag with the available modifications for this lens considering the image crop factor.

Not all lens profiles have sufficient amount of calibration data to do all kinds of corrections for all possible image crop factors. For example, sometimes vignetting is only available for a crop of 1.5 but has not been measured for a full frame crop of 1.0.

For crop -1.0 a flag with enabled bits for all available calibrations in the lens profile is returned ignoring the crop factor.

Parameters
cropCrop factor of the image for which we want to apply the corrections or -1.0 to get a flag of all available calibrations.
Returns
A set of LF_MODIFY_XXX flags.

◆ Check()

bool lfLens::Check ( )

Check if a lens object is valid.

Returns
true if the required fields are ok.

◆ GetCalibrationSets()

const lfLensCalibrationSet* const* lfLens::GetCalibrationSets ( ) const

Get a list of all calibration sets.

Returns
A null-terminated list of all calibration sets.

◆ GetCropDesc()

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
modeThe crop mode.
detailsIf not NULL, this string will be set to a more detailed (technical) description of the model. This string may contain newlines.
paramsIf 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.

◆ GetDistortionModelDesc()

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
modelThe model.
detailsIf not NULL, this string will be set to a more detailed (technical) description of the model. This string may contain newlines.
paramsIf 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.

◆ GetLensTypeDesc()

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
typeLens type.
detailsIf 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.

◆ GetMountNames()

const char* const* lfLens::GetMountNames ( ) const

Get a list of all mount names.

Returns
A null-terminated list of all mount names.

◆ GetTCAModelDesc()

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
modelThe model.
detailsIf not NULL, this string will be set to a more detailed (technical) description of the model. This string may contain newlines.
paramsIf 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.

◆ GetVignettingModelDesc()

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
modelThe model.
detailsIf not NULL, this string will be set to a more detailed (technical) description of the model. This string may contain newlines.
paramsIf 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.

◆ GuessParameters()

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.

◆ InterpolateCrop()

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

Interpolate lens crop data for given focal length.

Parameters
cropCrop factor of the image for which we need image parameters.
focalThe focal length in mm at which we need image parameters.
resThe resulting interpolated information data.
Returns
False if there is not sufficient calibration data for the requested parameters, otherwise it returns true.

◆ InterpolateDistortion()

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

Interpolate lens geometry distortion data for given focal length and crop factor.

Parameters
cropCrop factor of the image for which we need geometry distortion parameters.
focalThe focal length in mm at which we need geometry distortion parameters.
resThe resulting interpolated model.
Returns
False if there is not sufficient calibration data for the requested parameters, otherwise it returns true.

◆ InterpolateTCA()

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

Interpolate lens TCA calibration data for given focal length.

Parameters
cropCrop factor of the image for which we need TCA parameters.
focalThe focal length in mm at which we need TCA parameters.
resThe resulting interpolated model.
Returns
False if there is not sufficient calibration data for the requested parameters, otherwise it returns true.

◆ InterpolateVignetting()

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

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

Parameters
cropCrop factor of the image for which we need vignetting parameters.
focalThe focal length in mm for which we need vignetting parameters.
apertureThe aperture (f-number) for which we need vignetting parameters.
distanceThe focus distance in meters (distance > 0) for which we need vignetting parameters.
resThe resulting interpolated model.
Returns
False if there is not sufficient calibration data for the requested parameters, otherwise it returns true.

◆ operator=()

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

Assignment operator

◆ SetMaker()

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
valThe new value for the Maker field.
langThe language this field is in.

◆ SetModel()

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
valThe new value for the Model field.
langThe language this field is in.

Member Data Documentation

◆ AspectRatio

DEPRECATED float lfLens::AspectRatio

Aspect ratio of the images used for calibration measurements.

Examples
tfun.cpp.

◆ CalibCrop

DEPRECATED lfLensCalibCrop** lfLens::CalibCrop

Crop data, NULL-terminated (unsorted)

◆ CalibDistortion

DEPRECATED lfLensCalibDistortion** lfLens::CalibDistortion

Lens distortion calibration data, NULL-terminated (unsorted)

◆ CalibFov

DEPRECATED lfLensCalibFov** lfLens::CalibFov

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

◆ CalibTCA

DEPRECATED lfLensCalibTCA** lfLens::CalibTCA

Lens TCA calibration data, NULL-terminated (unsorted)

◆ CalibVignetting

DEPRECATED lfLensCalibVignetting** lfLens::CalibVignetting

Lens vignetting calibration data, NULL-terminated (unsorted)

◆ CenterX

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.

◆ CenterY

float lfLens::CenterY

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

Examples
tfun.cpp.

◆ CropFactor

DEPRECATED float lfLens::CropFactor

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

Examples
tfun.cpp.

◆ Maker

lfMLstr lfLens::Maker

Lens maker (ex: "Rollei")

Examples
tfun.cpp.

◆ MaxAperture

float lfLens::MaxAperture

Biggest f-number possible (ex: 22).

Examples
tfun.cpp.

◆ MaxFocal

float lfLens::MaxFocal

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

Examples
tfun.cpp.

◆ MinAperture

float lfLens::MinAperture

Smallest f-number possible (ex: 3.5).

Examples
lenstool.cpp, and tfun.cpp.

◆ MinFocal

float lfLens::MinFocal

Minimum focal length, mm (ex: 35).

Examples
lenstool.cpp, and tfun.cpp.

◆ Model

lfMLstr lfLens::Model

Lens model (ex: "Zoom-Rolleinar")

Examples
lenstool.cpp, and tfun.cpp.

◆ Mounts

DEPRECATED char** lfLens::Mounts

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

Examples
example.c, and tfun.cpp.

◆ Score

int lfLens::Score

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

◆ Type

lfLensType lfLens::Type

Lens type


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