Go to the documentation of this file.
29 # define C_TYPEDEF(t,c)
31 # define C_TYPEDEF(t,c) typedef t c c;
47 #define LF_VERSION_MAJOR 0
49 #define LF_VERSION_MINOR 2
51 #define LF_VERSION_MICRO 7
53 #define LF_VERSION_BUGFIX 0
55 #define LF_VERSION ((LF_VERSION_MAJOR << 24) | (LF_VERSION_MINOR << 16) | (LF_VERSION_MICRO << 8) | LF_VERSION_BUGFIX)
58 #if defined CONF_LENSFUN_STATIC
62 # ifdef CONF_SYMBOL_VISIBILITY
63 # if defined PLATFORM_WINDOWS
64 # define LF_EXPORT __declspec(dllexport)
65 # elif defined CONF_COMPILER_GCC
66 # define LF_EXPORT __attribute__((visibility("default")))
68 # error "I don't know how to change symbol visibility for your compiler"
71 # if defined PLATFORM_WINDOWS || defined _MSC_VER
72 # define LF_EXPORT __declspec(dllimport)
197 void SetName (
const char *val,
const char *lang = NULL);
316 void SetMaker (
const char *val,
const char *lang = NULL);
326 void SetModel (
const char *val,
const char *lang = NULL);
749 void SetMaker (
const char *val,
const char *lang = NULL);
759 void SetModel (
const char *val,
const char *lang = NULL);
1206 lfError Load (
const char *errcontext,
const char *data,
size_t data_size);
1233 const lfLens *
const *lenses)
const;
1249 const lfLens *
const *lenses);
1296 int sflags = 0)
const;
1344 const char *model,
int sflags = 0)
const;
1439 const
char *data,
size_t data_size);
1448 const
lfLens *const *lenses);
1453 const
lfLens *const *lenses);
1457 const
lfDatabase *db, const
char *maker, const
char *model);
1461 const
lfDatabase *db, const
char *maker, const
char *model,
int sflags);
1469 const
char *lens,
int sflags);
1564 #define LF_CR_1(a) (LF_CR_ ## a)
1566 #define LF_CR_2(a,b) ((LF_CR_ ## a) | ((LF_CR_ ## b) << 4))
1568 #define LF_CR_3(a,b,c) ((LF_CR_ ## a) | ((LF_CR_ ## b) << 4) | \
1569 ((LF_CR_ ## c) << 8))
1571 #define LF_CR_4(a,b,c,d) ((LF_CR_ ## a) | ((LF_CR_ ## b) << 4) | \
1572 ((LF_CR_ ## c) << 8) | ((LF_CR_ ## d) << 12))
1574 #define LF_CR_5(a,b,c,d,e) ((LF_CR_ ## a) | ((LF_CR_ ## b) << 4) | \
1575 ((LF_CR_ ## c) << 8) | ((LF_CR_ ## d) << 12) | \
1576 ((LF_CR_ ## e) << 16))
1578 #define LF_CR_6(a,b,c,d,e,f) ((LF_CR_ ## a) | ((LF_CR_ ## b) << 4) | \
1579 ((LF_CR_ ## c) << 8) | ((LF_CR_ ## d) << 12) | \
1580 ((LF_CR_ ## e) << 16) | ((LF_CR_ ## f) << 20))
1582 #define LF_CR_7(a,b,c,d,e,f,g) ((LF_CR_ ## a) | ((LF_CR_ ## b) << 4) | \
1583 ((LF_CR_ ## c) << 8) | ((LF_CR_ ## d) << 12) | \
1584 ((LF_CR_ ## e) << 16) | ((LF_CR_ ## f) << 20) | \
1585 ((LF_CR_ ## g) << 24))
1587 #define LF_CR_8(a,b,c,d,e,f,g,h) ((LF_CR_ ## a) | ((LF_CR_ ## b) << 4) | \
1588 ((LF_CR_ ## c) << 8) | ((LF_CR_ ## d) << 12) | \
1589 ((LF_CR_ ## e) << 16) | ((LF_CR_ ## f) << 20) | \
1590 ((LF_CR_ ## g) << 24) | ((LF_CR_ ## h) << 28))
1632 void *pixels,
int comp_role,
int count);
1773 float distance,
float scale,
lfLensType targeom,
int flags,
bool reverse);
1798 void *data,
size_t data_size);
1818 void *data,
size_t data_size);
1837 void *data,
size_t data_size);
1869 bool reverse =
false);
1886 bool reverse =
false);
2007 int comp_role,
int row_stride)
const;
2072 #elif defined _MSC_VER
2082 const
lfLens *lens,
float crop,
int width,
int height);
2090 float focal,
float aperture,
float distance,
float scale,
2096 void *data,
size_t data_size);
2101 void *data,
size_t data_size);
2106 void *data,
size_t data_size);
2140 lfModifier *modifier,
float xu,
float yu,
int width,
int height,
float *res);
2144 lfModifier *modifier,
void *pixels,
float x,
float y,
int width,
int height,
2145 int comp_role,
int row_stride);
2149 lfModifier *modifier,
float xu,
float yu,
int width,
int height,
float *res);
2153 lfModifier *modifier,
float xu,
float yu,
int width,
int height,
float *res);
lfModifier * lf_modifier_new(const lfLens *lens, float crop, int width, int height)
Lens distortion calibration data.
Definition: lensfun.h:444
void SetMount(const char *val)
Set the value for camera Mount.
@ LF_PF_F64
64-bit floating-point R,G,B
Definition: lensfun.h:1529
Camera data.
Definition: lensfun.h:273
void SetModel(const char *val, const char *lang=NULL)
Add a string to camera model.
const lfCamera ** lf_db_find_cameras(const lfDatabase *db, const char *maker, const char *model)
cbool lf_lens_interpolate_vignetting(const lfLens *lens, float focal, float aperture, float distance, lfLensCalibVignetting *res)
#define LF_EXPORT
This macro expands to an appropiate symbol visibility declaration.
Definition: lensfun.h:60
@ LF_PF_U32
Unsigned 32-bit R,G,B.
Definition: lensfun.h:1525
void lf_mount_destroy(lfMount *mount)
Destroy a lfMount object.
lfMLstr Maker
Camera maker (ex: "Rollei") – same as in EXIF.
Definition: lensfun.h:275
lfVignettingModel
The lensdb library supports several models for lens vignetting correction.
Definition: lensfun.h:517
@ LF_WRONG_FORMAT
Wrong XML data format.
Definition: lensfun.h:98
@ LF_RECTILINEAR
A rectilinear lens - 99% of all lenses are of this type.
Definition: lensfun.h:634
lfMLstr Model
Model name (ex: "Rolleiflex SL35") – same as in EXIF.
Definition: lensfun.h:277
char ** Compat
A list of compatible mounts.
Definition: lensfun.h:171
~lfCamera()
Destroy a camera object.
@ LF_SEARCH_LOOSE
This flag selects a looser search algorithm resulting in more results (still sorted by score).
Definition: lensfun.h:1129
float Aperture
Aperture at which this calibration data was taken (0 - unspecified)
Definition: lensfun.h:545
@ LF_PF_F32
32-bit floating-point R,G,B
Definition: lensfun.h:1527
bool RemoveCalibDistortion(int idx)
Remove a calibration entry from the distortion calibration data.
@ LF_MODIFY_DISTORTION
Correct (or apply) lens distortion.
Definition: lensfun.h:1508
float CenterY
The vertical shift of all lens distortions.
Definition: lensfun.h:696
bool Check()
Check if a mount object is valid.
lfError lf_db_load_file(lfDatabase *db, const char *filename)
@ LF_DIST_MODEL_FOV1
Field-of-view lens model: Ru = tg (Rd * omega) / (2 * tg (omega/2)) Ref: ftp://ftp-sop....
Definition: lensfun.h:428
cbool lf_modifier_add_coord_callback_geometry(lfModifier *modifier, lfLensType from, lfLensType to, float focal)
cbool lf_lens_interpolate_fov(const lfLens *lens, float focal, lfLensCalibFov *res)
cbool lf_modifier_apply_subpixel_distortion(lfModifier *modifier, float xu, float yu, int width, int height, float *res)
float Max
Maximal value that has sense.
Definition: lensfun.h:619
lfMLstr Maker
Lens maker (ex: "Rollei")
Definition: lensfun.h:672
float lf_modifier_get_auto_scale(lfModifier *modifier, cbool reverse)
void lf_lens_add_calib_fov(lfLens *lens, const lfLensCalibFov *cf)
cbool lf_modifier_add_coord_callback_distortion(lfModifier *modifier, lfLensCalibDistortion *model, cbool reverse)
lfMLstr lf_mlstr_dup(const lfMLstr str)
Create a complete copy of a multi-language string.
bool InterpolateDistortion(float focal, lfLensCalibDistortion &res) const
Interpolate lens geometry distortion data for given focal length.
@ LF_CR_RED
This is the Red pixel component.
Definition: lensfun.h:1554
lfError Load(const char *filename)
Load just a specific XML file.
lfError
liblensdb error codes: negative codes are -errno, positive are here
Definition: lensfun.h:94
@ LF_PF_U8
Unsigned 8-bit R,G,B.
Definition: lensfun.h:1521
void lf_modifier_add_subpixel_callback(lfModifier *modifier, lfSubpixelCoordFunc callback, int priority, void *data, size_t data_size)
Lens vignetting calibration data.
Definition: lensfun.h:539
char * HomeDataDir
Home lens database directory (something like "~/.local/share/lensfun")
Definition: lensfun.h:1157
lfMLstr Variant
Camera variant.
Definition: lensfun.h:279
float CropFactor
Camera crop factor (ex: 1.0).
Definition: lensfun.h:283
@ LF_CR_UNKNOWN
This component has an unknown/doesn't matter role.
Definition: lensfun.h:1550
bool InterpolateVignetting(float focal, float aperture, float distance, lfLensCalibVignetting &res) const
Interpolate lens vignetting model parameters for given focal length, aperture and subject distance.
float Focal
Focal length at which this calibration data was taken (0 - unspecified)
Definition: lensfun.h:597
void SetMaker(const char *val, const char *lang=NULL)
Add a string to camera maker.
lfLensType Type
Lens type.
Definition: lensfun.h:706
@ LF_NO_CROP
no crop at all
Definition: lensfun.h:560
bool AddSubpixelCallbackTCA(lfLensCalibTCA &model, bool reverse=false)
Add the stock TCA correcting callback into the chain.
@ LF_DIST_MODEL_POLY5
5th order polynomial model: Ru = Rd * (1 + k1 * Rd^2 + k2 * Rd^4)
Definition: lensfun.h:422
This structure describes a single parameter for some lens model.
Definition: lensfun.h:613
static const char * GetLensTypeDesc(lfLensType type, const char **details)
Get the human-readable lens type name and a short description of this lens type.
cbool lf_modifier_apply_subpixel_geometry_distortion(lfModifier *modifier, float xu, float yu, int width, int height, float *res)
lfLens * lf_lens_new()
Create a new lens object.
void lf_lens_destroy(lfLens *lens)
Destroy a lfLens object.
cbool lf_modifier_add_color_callback_CCI(lfModifier *modifier, const lfLens *lens, lfPixelFormat format, cbool reverse)
void lf_lens_add_calib_vignetting(lfLens *lens, const lfLensCalibVignetting *vc)
Laterlal chromatic aberrations calibration data.
Definition: lensfun.h:494
lfTCAModel
The lensdb library supports several models for lens lateral chromatic aberrations (also called transv...
Definition: lensfun.h:465
bool ApplySubpixelGeometryDistortion(float xu, float yu, int width, int height, float *res) const
Apply stage 1 & 3 in one step.
@ LF_CR_BLUE
This is the Blue pixel component.
Definition: lensfun.h:1558
@ LF_NO_ERROR
No error occured.
Definition: lensfun.h:96
@ LF_TCA_MODEL_LINEAR
Linear lateral chromatic aberrations model: Cd(R) = Cs(R) * kr Cd(B) = Cs(B) * kb Ref: http://cipa....
Definition: lensfun.h:474
lfLensType
Lens type.
Definition: lensfun.h:630
int Initialize(const lfLens *lens, lfPixelFormat format, float focal, float aperture, float distance, float scale, lfLensType targeom, int flags, bool reverse)
Initialize the process of correcting aberrations in a image.
@ LF_MODIFY_TCA
Correct (or apply) lens transversal chromatic aberrations.
Definition: lensfun.h:1502
@ LF_FISHEYE_STEREOGRAPHIC
stereographic fisheye
Definition: lensfun.h:650
void SetName(const char *val, const char *lang=NULL)
Add a string to mount name.
void SetVariant(const char *val, const char *lang=NULL)
Add a string to camera variant.
const lfLens ** FindLenses(const lfCamera *camera, const char *maker, const char *model, int sflags=0) const
Parse a human-friendly lens description (ex: "smc PENTAX-F 35-105mm F4-5.6" or "SIGMA AF 28-300 F3....
cbool lf_lens_remove_calib_vignetting(lfLens *lens, int idx)
lfDistortionModel
The lensdb library implements several lens distortion models.
Definition: lensfun.h:409
float MinFocal
Minimum focal length, mm (ex: 35).
Definition: lensfun.h:676
void SetModel(const char *val, const char *lang=NULL)
Add a string to camera model.
void lf_modifier_destroy(lfModifier *modifier)
char * Mount
Camera mount type (ex: "QBM")
Definition: lensfun.h:281
@ LF_CROP_CIRCLE
use a circular crop, e.g.
Definition: lensfun.h:564
void lf_lens_guess_parameters(lfLens *lens)
const lfLens ** lf_db_find_lenses_hd(const lfDatabase *db, const lfCamera *camera, const char *maker, const char *lens, int sflags)
float GreenCCI
Green component of lens CCI.
Definition: lensfun.h:700
void AddCalibFov(const lfLensCalibFov *cf)
Add a new lens fov structure to the pool.
cbool lf_modifier_apply_color_modification(lfModifier *modifier, void *pixels, float x, float y, int width, int height, int comp_role, int row_stride)
float CropFactor
Crop factor at which calibration measurements were taken.
Definition: lensfun.h:704
bool ApplySubpixelDistortion(float xu, float yu, int width, int height, float *res) const
Image correction stage 1: apply subpixel distortions.
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.
lfMLstr Name
Camera mount name.
Definition: lensfun.h:169
char ** Mounts
Available mounts (NULL-terminated list) (ex: { "QBM", NULL })
Definition: lensfun.h:684
@ LF_PF_U16
Unsigned 16-bit R,G,B.
Definition: lensfun.h:1523
const lfCamera *const * lf_db_get_cameras(const lfDatabase *db)
void(* lfModifyColorFunc)(void *data, float x, float y, void *pixels, int comp_role, int count)
A callback function which modifies the colors of a strip of pixels This kind of callbacks are used in...
Definition: lensfun.h:1631
bool RemoveCalibCrop(int idx)
Remove a lens crop entry from the lens crop structure.
const char * lf_db_mount_name(const lfDatabase *db, const char *mount)
int lf_modifier_initialize(lfModifier *modifier, const lfLens *lens, lfPixelFormat format, float focal, float aperture, float distance, float scale, lfLensType targeom, int flags, cbool reverse)
void lf_modifier_add_color_callback(lfModifier *modifier, lfModifyColorFunc callback, int priority, void *data, size_t data_size)
bool AddCoordCallbackGeometry(lfLensType from, lfLensType to, float focal)
Add the stock lens geometry rectification callback into the chain.
@ LF_DIST_MODEL_POLY3
3rd order polynomial model: Ru = Rd * (1 - k1 + k1 * Rd^2) Ref: http://www.imatest....
Definition: lensfun.h:417
lfError Save(const char *filename, const lfMount *const *mounts, const lfCamera *const *cameras, const lfLens *const *lenses) const
Save a set of camera and lens descriptions to a file.
@ 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)...
Definition: lensfun.h:482
@ LF_DIST_MODEL_PTLENS
PTLens rectilinear: Ru = Rd * (a * Rd^3 + b * Rd^2 + c * Rd + 1 - a - b - c)
Definition: lensfun.h:433
void lf_camera_copy(lfCamera *dest, const lfCamera *source)
Copy the data from one lfCamera structure into another.
@ LF_CROP_RECTANGLE
use a rectangular crop
Definition: lensfun.h:562
void lf_lens_add_calib_tca(lfLens *lens, const lfLensCalibTCA *tcac)
void AddMount(const char *val)
Add a new mount type to this lens.
Struct to save image crop, which can depend on the focal length.
Definition: lensfun.h:573
static lfModifier * Create(const lfLens *lens, float crop, int width, int height)
Create a empty image modifier object.
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 param...
lfLensCalibFov ** CalibFov
Field of view calibration data, NULL-terminated (unsorted)
Definition: lensfun.h:716
bool AddColorCallbackCCI(const lfLens *lens, lfPixelFormat format, bool reverse=false)
Add the stock CCI correcting callback into the chain.
bool RemoveCalibFov(int idx)
Remove a field of view entry from the lens fov structure.
bool AddColorCallbackVignetting(lfLensCalibVignetting &model, lfPixelFormat format, bool reverse=false)
Add the stock lens vignetting correcting callback into the chain.
float Focal
Focal length at which this calibration data was taken (0 - unspecified)
Definition: lensfun.h:448
const char * Name
Parameter name (something like 'k', 'k3', 'omega' etc.
Definition: lensfun.h:615
@ LF_MODIFY_VIGNETTING
Correct (or apply) lens vignetting.
Definition: lensfun.h:1504
const char * lf_mlstr_get(const lfMLstr str)
Get a string corresponding to current locale from a multi-language string.
float MaxFocal
Maximum focal length, mm (ex: 105).
Definition: lensfun.h:678
@ LF_FISHEYE_ORTHOGRAPHIC
orthographic fisheye
Definition: lensfun.h:648
cbool lf_modifier_add_coord_callback_scale(lfModifier *modifier, float scale, cbool reverse)
cbool lf_lens_interpolate_crop(const lfLens *lens, float focal, lfLensCalibCrop *res)
const lfMount *const * lf_db_get_mounts(const lfDatabase *db)
void lf_camera_destroy(lfCamera *camera)
Destroy a lfCamera object.
float Focal
Focal length at which this calibration data was taken (0 - unspecified)
Definition: lensfun.h:575
void AddCoordCallback(lfModifyCoordFunc callback, int priority, void *data, size_t data_size)
Add a user-defined callback to the coordinate correction chain.
cbool lf_lens_remove_calib_fov(lfLens *lens, int idx)
bool AddCoordCallbackDistortion(lfLensCalibDistortion &model, bool reverse=false)
Add the stock lens distortion correcting callback into the chain.
lfLensCalibCrop ** CalibCrop
Crop data, NULL-terminated (unsorted)
Definition: lensfun.h:714
int Score
Lens matching score, used while searching: not actually a lens parameter.
Definition: lensfun.h:718
const lfLens ** FindLenses(const lfLens *lens, int sflags=0) const
Find a set of lenses that fit certain criteria.
bool Check()
Check if a lens object is valid.
const lfMount * lf_db_find_mount(const lfDatabase *db, const char *mount)
void lf_lens_copy(lfLens *dest, const lfLens *source)
Copy the data from one lfLens structure into another.
lfComponentRole
These constants define the role of every pixel component, four bits each.
Definition: lensfun.h:1536
float Distance
Distance to subject (important only for vignetting)
Definition: lensfun.h:547
@ LF_FISHEYE_EQUISOLID
equisolid fisheye
Definition: lensfun.h:652
const lfCamera ** FindCamerasExt(const char *maker, const char *model, int sflags=0) const
This function is somewhat similar to FindCameras(), but uses a different search algorithm.
void AddColorCallback(lfModifyColorFunc callback, int priority, void *data, size_t data_size)
Add a user-defined callback to the color modification chain.
void AddCompat(const char *val)
Add a mount name to the list of compatible mounts.
bool InterpolateCrop(float focal, lfLensCalibCrop &res) const
Interpolate lens crop data for given focal length.
bool RemoveCalibTCA(int idx)
Remove a calibration entry from the TCA calibration data.
@ LF_FISHEYE_THOBY
fisheye Thoby (for Nikkor 10.5)
Definition: lensfun.h:654
lfError Load()
Load the whole lens database.
void AddCalibDistortion(const lfLensCalibDistortion *dc)
Add a new distortion calibration structure to the pool.
cbool lf_modifier_add_subpixel_callback_TCA(lfModifier *modifier, lfLensCalibTCA *model, cbool reverse)
This structure contains everything specific to a camera mount.
Definition: lensfun.h:167
@ LF_MODIFY_CCI
Correct (or apply) lens color contribution index.
Definition: lensfun.h:1506
~lfLens()
Destroy this and all associated objects.
void lf_lens_add_calib_distortion(lfLens *lens, const lfLensCalibDistortion *dc)
void lf_modifier_add_coord_callback(lfModifier *modifier, lfModifyCoordFunc callback, int priority, void *data, size_t data_size)
cbool lf_mount_check(lfMount *mount)
@ LF_UNKNOWN
Unknown lens type.
Definition: lensfun.h:632
const lfCamera ** FindCameras(const char *maker, const char *model) const
Find a set of cameras that fit given criteria.
bool ApplyGeometryDistortion(float xu, float yu, int width, int height, float *res) const
Image correction step 3: apply the transforms on a block of pixel coordinates.
const lfCamera ** lf_db_find_cameras_ext(const lfDatabase *db, const char *maker, const char *model, int sflags)
const char * lf_get_tca_model_desc(enum lfTCAModel model, const char **details, const lfParameter ***params)
@ LF_EQUIRECTANGULAR
Equirectangular (not that there are such lenses, but useful to convert images TO this type,...
Definition: lensfun.h:646
float MinAperture
Aperture at minimum focal length (ex: 3.5).
Definition: lensfun.h:680
void Destroy()
Destroy the database object and free all loaded data.
void(* lfSubpixelCoordFunc)(void *data, float *iocoord, int count)
A callback function which modifies the separate coordinates for all color components for every pixel ...
Definition: lensfun.h:1606
@ LF_MODIFY_ALL
Apply all possible corrections.
Definition: lensfun.h:1514
const char * lf_get_distortion_model_desc(enum lfDistortionModel model, const char **details, const lfParameter ***params)
bool InterpolateTCA(float focal, lfLensCalibTCA &res) const
Interpolate lens TCA calibration data for given focal length.
const char * lf_get_lens_type_desc(enum lfLensType type, const char **details)
void(* lfModifyCoordFunc)(void *data, float *iocoord, int count)
A callback function which modifies the coordinates of a strip of pixels.
Definition: lensfun.h:1645
float FieldOfView
Field of view for given images.
Definition: lensfun.h:604
@ LF_CR_INTENSITY
This is the pixel intensity (grayscale)
Definition: lensfun.h:1552
#define C_TYPEDEF(t, c)
Helper macro to make C/C++ work similarly.
Definition: lensfun.h:29
void SetMaker(const char *val, const char *lang=NULL)
Add a string to camera maker.
float Default
Default value for the parameter.
Definition: lensfun.h:621
float MaxAperture
Aperture at maximum focal length (ex: 4.3).
Definition: lensfun.h:682
const lfLens ** lf_db_find_lenses(const lfDatabase *db, const lfLens *lens, int sflags)
void lf_db_destroy(lfDatabase *db)
Destroy the database object.
lfLensCalibDistortion ** CalibDistortion
Lens distortion calibration data, NULL-terminated (unsorted)
Definition: lensfun.h:708
lfCropMode
Different crop modes.
Definition: lensfun.h:558
bool AddCoordCallbackScale(float scale, bool reverse=false)
Add the stock image scaling callback into the chain.
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 ...
@ LF_TCA_MODEL_NONE
No TCA correction data is known.
Definition: lensfun.h:467
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 ...
void AddCalibCrop(const lfLensCalibCrop *cc)
Add a new lens crop structure to the pool.
char * lfMLstr
The storage of "multi-language" strings is simple yet flexible, handy and effective.
Definition: lensfun.h:90
@ LF_CR_GREEN
This is the Green pixel component.
Definition: lensfun.h:1556
void lf_mount_copy(lfMount *dest, const lfMount *source)
Copy the data from one lfMount structure into another.
const lfMount *const * GetMounts() const
Retrieve a full list of mounts.
lfDatabase * lf_db_new(void)
Create a new empty database object.
lfMLstr Model
Lens model (ex: "Zoom-Rolleinar")
Definition: lensfun.h:674
lfMount * lf_mount_new()
Create a new mount object.
float GetAutoScale(bool reverse)
Compute the automatic scale factor for the image.
void AddCalibTCA(const lfLensCalibTCA *tcac)
Add a new transversal chromatic aberration calibration structure to the pool.
A lens database object.
Definition: lensfun.h:1155
const lfCamera *const * GetCameras() const
Retrieve a full list of cameras.
@ LF_CR_NEXT
This value tells that what follows applies to next pixel.
Definition: lensfun.h:1548
lfPixelFormat
A list of pixel formats supported by internal colour callbacks.
Definition: lensfun.h:1519
@ LF_FISHEYE
Fisheye lens Ref: http://wiki.panotools.org/Fisheye_Projection.
Definition: lensfun.h:639
@ LF_DIST_MODEL_NONE
Distortion parameters are unknown.
Definition: lensfun.h:411
lfError lf_db_load_data(lfDatabase *db, const char *errcontext, const char *data, size_t data_size)
float RedCCI
Lens colour contribution index (ISO/CCI, ISO 6728:1983).
Definition: lensfun.h:698
@ LF_VIGNETTING_MODEL_PA
Pablo D'Angelo vignetting model (which is a more general variant of the cos^4 law): Cd = Cs * (1 + k1...
Definition: lensfun.h:526
void AddCalibVignetting(const lfLensCalibVignetting *vc)
Add a new vignetting calibration structure to the pool.
cbool lf_modifier_add_color_callback_vignetting(lfModifier *modifier, lfLensCalibVignetting *model, lfPixelFormat format, cbool reverse)
int Score
Camera matching score, used while searching: not actually a camera parameter.
Definition: lensfun.h:285
const lfMount * FindMount(const char *mount) const
Return the lfMount structure given the (basic) mount name.
cbool lf_camera_check(lfCamera *camera)
cbool lf_lens_interpolate_tca(const lfLens *lens, float focal, lfLensCalibTCA *res)
lfError Save(const char *filename) const
Save the whole database to a file.
cbool lf_modifier_apply_geometry_distortion(lfModifier *modifier, float xu, float yu, int width, int height, float *res)
bool RemoveCalibVignetting(int idx)
Remove a calibration entry from the vignetting calibration data.
lfError lf_db_save_all(const lfDatabase *db, const char *filename)
lfCamera()
Initialize a new camera object.
lfCamera * lf_camera_new()
Create a new camera object.
#define cbool
C-compatible bool type; don't bother to define Yet Another Boolean Type.
Definition: lensfun.h:80
lfError Load(const char *errcontext, const char *data, size_t data_size)
Load a set of camera/lenses from a memory array.
void GuessParameters()
This method fills some fields if they are missing but can be derived from other fields.
lfLensCalibTCA ** CalibTCA
Lens TCA calibration data, NULL-terminated (unsorted)
Definition: lensfun.h:710
Lens data.
Definition: lensfun.h:670
cbool lf_lens_remove_calib_distortion(lfLens *lens, int idx)
~lfMount()
Destroy a mount object.
lfLens(const lfLens &other)
Copy constructor.
const lfLens *const * GetLenses() const
Retrieve a full list of lenses.
lfMount()
Initialize a new mount object.
const lfLens *const * lf_db_get_lenses(const lfDatabase *db)
static lfDatabase * Create()
Create a new empty database object.
float CenterX
The horizontal shift of all lens distortions.
Definition: lensfun.h:694
char * lf_db_save(const lfMount *const *mounts, const lfCamera *const *cameras, const lfLens *const *lenses)
bool InterpolateFov(float focal, lfLensCalibFov &res) const
Interpolate lens fov data for given focal length.
float Focal
Focal length at which this calibration data was taken (0 - unspecified)
Definition: lensfun.h:543
void AddSubpixelCallback(lfSubpixelCoordFunc callback, int priority, void *data, size_t data_size)
Add a user-defined callback to the subpixel coordinate rectification chain.
lfLens()
Create a new lens object, initializing all fields to default values.
const char * lf_get_crop_desc(enum lfCropMode mode, const char **details, const lfParameter ***params)
float Focal
Focal length at which this calibration data was taken (0 - unspecified)
Definition: lensfun.h:498
cbool lf_lens_remove_calib_crop(lfLens *lens, int idx)
cbool lf_lens_interpolate_distortion(const lfLens *lens, float focal, lfLensCalibDistortion *res)
lfError lf_db_save_file(const lfDatabase *db, const char *filename, const lfMount *const *mounts, const lfCamera *const *cameras, const lfLens *const *lenses)
@ LF_MODIFY_GEOMETRY
Convert image geometry.
Definition: lensfun.h:1510
@ LF_VIGNETTING_MODEL_NONE
No vignetting correction data is known.
Definition: lensfun.h:519
@ LF_MODIFY_SCALE
Additional resize of image.
Definition: lensfun.h:1512
const char * MountName(const char *mount) const
Get the name of a mount in current locale.
lfMLstr lf_mlstr_add(lfMLstr str, const char *lang, const char *trstr)
Add a new translated string to a multi-language string.
float Min
Minimal value that has sense.
Definition: lensfun.h:617
lfError lf_db_load(lfDatabase *db)
void lf_free(void *data)
The basics of memory allocation: never free objects allocated by the library yourselves,...
cbool lf_lens_check(lfLens *lens)
const char * lf_get_vignetting_model_desc(enum lfVignettingModel model, const char **details, const lfParameter ***params)
A modifier object contains optimized data required to rectify a image.
Definition: lensfun.h:1707
lfLensCalibVignetting ** CalibVignetting
Lens vignetting calibration data, NULL-terminated (unsorted)
Definition: lensfun.h:712
@ LF_PANORAMIC
Panoramic (cylindrical)
Definition: lensfun.h:641
void Destroy()
Destroy the modifier object.
bool ApplyColorModification(void *pixels, float x, float y, int width, int height, int comp_role, int row_stride) const
Image correction step 2: fix image colors.
void lf_lens_add_calib_crop(lfLens *lens, const lfLensCalibCrop *cc)
cbool lf_lens_remove_calib_tca(lfLens *lens, int idx)
float BlueCCI
Blue component of lens CCI.
Definition: lensfun.h:702
Struct to save calibrated field of view, which can depends on the focal length.
Definition: lensfun.h:595
lfCamera(const lfCamera &other)
Copy constructor.
static char * Save(const lfMount *const *mounts, const lfCamera *const *cameras, const lfLens *const *lenses)
Save a set of camera and lens descriptions into a memory array.
@ LF_CR_END
This marks the end of the role list.
Definition: lensfun.h:1541