30 #  define C_TYPEDEF(t,c)    32 #  define C_TYPEDEF(t,c) typedef t c c;    48 #define LF_VERSION_MAJOR        0    50 #define LF_VERSION_MINOR        3    52 #define LF_VERSION_MICRO        1    54 #define LF_VERSION_BUGFIX       0    56 #define LF_VERSION      ((LF_VERSION_MAJOR << 24) | (LF_VERSION_MINOR << 16) | (LF_VERSION_MICRO << 8) | LF_VERSION_BUGFIX)    60 #define LF_MAX_DATABASE_VERSION 1    62 #if defined CONF_LENSFUN_STATIC    66 #   ifdef CONF_SYMBOL_VISIBILITY    67 #       if defined PLATFORM_WINDOWS    68 #           define LF_EXPORT    __declspec(dllexport)    69 #       elif defined CONF_COMPILER_GCC || __clang__    70 #           define LF_EXPORT    __attribute__((visibility("default")))    72 #           error "I don't know how to change symbol visibility for your compiler"    75 #       if defined PLATFORM_WINDOWS || defined _MSC_VER    76 #           define LF_EXPORT    __declspec(dllimport)    83 #ifndef CONF_LENSFUN_INTERNAL    86 #        define DEPRECATED __attribute__((deprecated))    87 #    elif defined(_MSC_VER)    88 #        define DEPRECATED __declspec(deprecated)    90 #        pragma message("WARNING: You need to implement DEPRECATED for this compiler")   225     void SetName (
const char *val, 
const char *lang = NULL);
   232     void AddCompat (
const char *val);
   346     void SetMaker (
const char *val, 
const char *lang = NULL);
   358     void SetModel (
const char *val, 
const char *lang = NULL);
   370     void SetVariant (
const char *val, 
const char *lang = NULL);
   377     void SetMount (
const char *val);
   840     lfLens (
const lfLens &other);
   850     lfLens &operator = (
const lfLens &other);
   862     void SetMaker (
const char *val, 
const char *lang = NULL);
   874     void SetModel (
const char *val, 
const char *lang = NULL);
   883     void AddMount (
const char *val);
   900     bool RemoveCalibDistortion (
int idx);
   918     bool RemoveCalibTCA (
int idx);
   935     bool RemoveCalibVignetting (
int idx);
   952     bool RemoveCalibCrop (
int idx);
   994     bool RemoveCalibRealFocal (
int idx);
  1004     void GuessParameters ();
  1028     static const char *GetDistortionModelDesc (
  1045     static const char *GetTCAModelDesc (
  1063     static const char *GetVignettingModelDesc (
  1081     static const char *GetCropDesc (
  1095     static const char *GetLensTypeDesc (
lfLensType type, 
const char **details);
  1128     bool InterpolateVignetting (
  1387     lfError Load (
const char *filename);
  1403     lfError Load (
const char *errcontext, 
const char *data, 
size_t data_size);
  1412     lfError Save (
const char *filename) 
const;
  1427     lfError Save (
const char *filename,
  1430                   const lfLens *
const *lenses) 
const;
  1444     static char *Save (
const lfMount *
const *mounts,
  1446                        const lfLens *
const *lenses);
  1472     const lfCamera **FindCameras (
const char *maker, 
const char *model) 
const;
  1494     const lfCamera **FindCamerasExt (
const char *maker, 
const char *model,
  1495                                      int sflags = 0) 
const;
  1504     const lfCamera *
const *GetCameras () 
const;
  1543     const lfLens **FindLenses (
const lfCamera *camera, 
const char *maker,
  1544                                const char *model, 
int sflags = 0) 
const;
  1563     const lfLens **FindLenses (
const lfLens *lens, 
int sflags = 0) 
const;
  1572     const lfLens *
const *GetLenses () 
const;
  1581     const lfMount *FindMount (
const char *mount) 
const;
  1590     const char *MountName (
const char *mount) 
const;
  1599     const lfMount *
const *GetMounts () 
const;
  1641                                    const char *data, 
size_t data_size);
  1650                                    const lfLens *
const *lenses);
  1655                             const lfLens *
const *lenses);
  1659     const lfDatabase *db, 
const char *maker, 
const char *model);
  1663     const lfDatabase *db, 
const char *maker, 
const char *model, 
int sflags);
  1671     const char *lens, 
int sflags);
  1767 #define LF_CR_1(a)              (LF_CR_ ## a)  1769 #define LF_CR_2(a,b)            ((LF_CR_ ## a) | ((LF_CR_ ## b) << 4))  1771 #define LF_CR_3(a,b,c)          ((LF_CR_ ## a) | ((LF_CR_ ## b) << 4) | \  1772                                  ((LF_CR_ ## c) << 8))  1774 #define LF_CR_4(a,b,c,d)        ((LF_CR_ ## a) | ((LF_CR_ ## b) << 4) | \  1775                                  ((LF_CR_ ## c) << 8) | ((LF_CR_ ## d) << 12))  1777 #define LF_CR_5(a,b,c,d,e)      ((LF_CR_ ## a) | ((LF_CR_ ## b) << 4) | \  1778                                  ((LF_CR_ ## c) << 8) | ((LF_CR_ ## d) << 12) | \  1779                                  ((LF_CR_ ## e) << 16))  1781 #define LF_CR_6(a,b,c,d,e,f)    ((LF_CR_ ## a) | ((LF_CR_ ## b) << 4) | \  1782                                  ((LF_CR_ ## c) << 8) | ((LF_CR_ ## d) << 12) | \  1783                                  ((LF_CR_ ## e) << 16) | ((LF_CR_ ## f) << 20))  1785 #define LF_CR_7(a,b,c,d,e,f,g)   ((LF_CR_ ## a) | ((LF_CR_ ## b) << 4) | \  1786                                  ((LF_CR_ ## c) << 8) | ((LF_CR_ ## d) << 12) | \  1787                                  ((LF_CR_ ## e) << 16) | ((LF_CR_ ## f) << 20) | \  1788                                  ((LF_CR_ ## g) << 24))  1790 #define LF_CR_8(a,b,c,d,e,f,g,h) ((LF_CR_ ## a) | ((LF_CR_ ## b) << 4) | \  1791                                  ((LF_CR_ ## c) << 8) | ((LF_CR_ ## d) << 12) | \  1792                                  ((LF_CR_ ## e) << 16) | ((LF_CR_ ## f) << 20) | \  1793                                  ((LF_CR_ ## g) << 24) | ((LF_CR_ ## h) << 28))  1837                                    void *pixels, 
int comp_role, 
int count);
  1958     static lfModifier *Create (
const lfLens *lens, 
float crop, 
int width, 
int height);
  2007         float distance, 
float scale, 
lfLensType targeom, 
int flags, 
bool reverse);
  2033                            void *data, 
size_t data_size);
  2053                               void *data, 
size_t data_size);
  2072                            void *data, 
size_t data_size);
  2088     bool AddSubpixelCallbackTCA (
lfLensCalibTCA &model, 
bool reverse = 
false);
  2105                                      bool reverse = 
false);
  2154     bool AddCoordCallbackScale (
float scale, 
bool reverse = 
false);
  2169     float GetAutoScale (
bool reverse);
  2200     bool ApplyColorModification (
void *pixels, 
float x, 
float y, 
int width, 
int height,
  2201                                  int comp_role, 
int row_stride) 
const;
  2233     bool ApplyGeometryDistortion (
float xu, 
float yu, 
int width, 
int height,
  2267     bool ApplySubpixelDistortion (
float xu, 
float yu, 
int width, 
int height,
  2300     bool ApplySubpixelGeometryDistortion (
float xu, 
float yu, 
int width, 
int height,
  2334     float GetRealFocalLength (
const lfLens *lens, 
float focal);
  2340 #elif defined _MSC_VER  2350     const lfLens *lens, 
float crop, 
int width, 
int height);
  2358     float focal, 
float aperture, 
float distance, 
float scale,
  2364     void *data, 
size_t data_size);
  2369     void *data, 
size_t data_size);
  2374     void *data, 
size_t data_size);
  2403     lfModifier *modifier, 
float xu, 
float yu, 
int width, 
int height, 
float *res);
  2407     lfModifier *modifier, 
void *pixels, 
float x, 
float y, 
int width, 
int height,
  2408     int comp_role, 
int row_stride);
  2412     lfModifier *modifier, 
float xu, 
float yu, 
int width, 
int height, 
float *res);
  2416     lfModifier *modifier, 
float xu, 
float yu, 
int width, 
int height, 
float *res);
 Panoramic (cylindrical) 
Definition: lensfun.h:748
 
lfError lf_db_load_file(lfDatabase *db, const char *filename)
 
lfDistortionModel
The lensfun library implements several lens distortion models. This enum lists them. 
Definition: lensfun.h:448
 
float MinAperture
Definition: lensfun.h:793
 
void(* lfModifyCoordFunc)(void *data, float *iocoord, int count)
A callback function which modifies the coordinates of a strip of pixels. 
Definition: lensfun.h:1851
 
Definition: lensfun.h:1724
 
Definition: lensfun.h:1753
 
cbool lf_modifier_apply_subpixel_geometry_distortion(lfModifier *modifier, float xu, float yu, int width, int height, float *res)
 
void lf_lens_add_calib_tca(lfLens *lens, const lfLensCalibTCA *tcac)
 
const lfCamera ** lf_db_find_cameras(const lfDatabase *db, const char *maker, const char *model)
 
DEPRECATED void lf_lens_add_calib_fov(lfLens *lens, const lfLensCalibFov *cf)
 
lfMLstr Maker
Definition: lensfun.h:785
 
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)
 
lfLensCalibDistortion ** CalibDistortion
Definition: lensfun.h:817
 
float FieldOfView
Field of view for given images. 
Definition: lensfun.h:678
 
Rectilinear lens. 
Definition: lensfun.h:735
 
Definition: lensfun.h:1709
 
lfLensType Type
Definition: lensfun.h:815
 
This flag makes LensFun to sort the results by focal length, and remove all double lens names...
Definition: lensfun.h:1320
 
char ** Compat
Definition: lensfun.h:197
 
lfLensCalibVignetting ** CalibVignetting
Definition: lensfun.h:821
 
char * UserUpdatesDir
Home lens database directory for automatic updates (something like "~/.local/share/lensfun/updates") ...
Definition: lensfun.h:1351
 
no crop at all 
Definition: lensfun.h:627
 
Definition: lensfun.h:1730
 
Definition: lensfun.h:1722
 
5th order polynomial model. 
Definition: lensfun.h:468
 
lfError
Definition: lensfun.h:111
 
const char * lf_get_distortion_model_desc(enum lfDistortionModel model, const char **details, const lfParameter ***params)
 
void lf_lens_guess_parameters(lfLens *lens)
 
float CenterX
Definition: lensfun.h:807
 
float CropFactor
Definition: lensfun.h:811
 
float Focal
Focal length in mm at which this calibration data was taken. 
Definition: lensfun.h:610
 
Laterlal chromatic aberrations calibration data. 
Definition: lensfun.h:552
 
Lens distortion calibration data. 
Definition: lensfun.h:487
 
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:1810
 
void lf_modifier_add_subpixel_callback(lfModifier *modifier, lfSubpixelCoordFunc callback, int priority, void *data, size_t data_size)
 
cbool lf_modifier_add_color_callback_vignetting(lfModifier *modifier, lfLensCalibVignetting *model, lfPixelFormat format, cbool reverse)
 
void lf_modifier_add_coord_callback(lfModifier *modifier, lfModifyCoordFunc callback, int priority, void *data, size_t data_size)
 
void lf_lens_copy(lfLens *dest, const lfLens *source)
Copy the data from one lfLens structure into another. 
 
void lf_mount_destroy(lfMount *mount)
Destroy a lfMount object. 
 
cbool lf_lens_remove_calib_tca(lfLens *lens, int idx)
 
cbool lf_lens_remove_calib_vignetting(lfLens *lens, int idx)
 
Lens data. Unknown fields are set to NULL or 0. 
Definition: lensfun.h:782
 
cbool lf_lens_interpolate_distortion(const lfLens *lens, float focal, lfLensCalibDistortion *res)
 
lfPixelFormat
A list of pixel formats supported by internal colour callbacks. 
Definition: lensfun.h:1719
 
Definition: lensfun.h:1713
 
float AspectRatio
Definition: lensfun.h:813
 
lfVignettingModel
The lensfun library supports several models for lens vignetting correction. 
Definition: lensfun.h:580
 
lfLensCalibTCA ** CalibTCA
Definition: lensfun.h:819
 
float CenterY
Definition: lensfun.h:809
 
cbool lf_modifier_add_coord_callback_scale(lfModifier *modifier, float scale, cbool reverse)
 
This structure contains everything specific to a camera mount. 
Definition: lensfun.h:188
 
float MinFocal
Definition: lensfun.h:789
 
const char * lf_db_mount_name(const lfDatabase *db, const char *mount)
 
Stereographic fisheye. 
Definition: lensfun.h:759
 
int Score
Definition: lensfun.h:829
 
Linear lateral chromatic aberrations model. 
Definition: lensfun.h:527
 
Third order polynomial. 
Definition: lensfun.h:540
 
Definition: lensfun.h:1711
 
use a circular crop, e.g. for circular fisheye images 
Definition: lensfun.h:631
 
#define cbool
C-compatible bool type; don't bother to define Yet Another Boolean Type. 
Definition: lensfun.h:98
 
lfMLstr Model
Definition: lensfun.h:787
 
float Focal
Focal length in mm at which this calibration data was taken. 
Definition: lensfun.h:642
 
cbool lf_modifier_apply_subpixel_distortion(lfModifier *modifier, float xu, float yu, int width, int height, float *res)
 
const lfLens ** lf_db_find_lenses_hd(const lfDatabase *db, const lfCamera *camera, const char *maker, const char *lens, int sflags)
 
int Score
Camera matching score, used while searching: not actually a camera parameter. 
Definition: lensfun.h:313
 
cbool lf_mount_check(lfMount *mount)
 
float lf_modifier_get_auto_scale(lfModifier *modifier, cbool reverse)
 
Orthographic fisheye. 
Definition: lensfun.h:757
 
const lfCamera *const  * lf_db_get_cameras(const lfDatabase *db)
 
lfModifier * lf_modifier_new(const lfLens *lens, float crop, int width, int height)
 
lfLensType
Lens type. See Change of projection for further information. 
Definition: lensfun.h:727
 
Definition: lensfun.h:1706
 
cbool lf_lens_remove_calib_crop(lfLens *lens, int idx)
 
float Focal
Definition: lensfun.h:690
 
PTLens model, which is also used by Hugin. 
Definition: lensfun.h:476
 
Definition: lensfun.h:1755
 
3rd order polynomial model, which is a subset of the PTLens model. 
Definition: lensfun.h:459
 
use a rectangular crop 
Definition: lensfun.h:629
 
const char * lf_get_tca_model_desc(enum lfTCAModel model, const char **details, const lfParameter ***params)
 
cbool lf_modifier_add_subpixel_callback_TCA(lfModifier *modifier, lfLensCalibTCA *model, cbool reverse)
 
const lfMount * lf_db_find_mount(const lfDatabase *db, const char *mount)
 
#define C_TYPEDEF(t, c)
Definition: lensfun.h:30
 
Equisolid fisheye. 
Definition: lensfun.h:761
 
Fisheye as measured by Thoby (for Nikkor 10.5). 
Definition: lensfun.h:767
 
const lfMount *const  * lf_db_get_mounts(const lfDatabase *db)
 
float Focal
Focal length in mm at which this calibration data was taken. 
Definition: lensfun.h:557
 
cbool lf_lens_interpolate_crop(const lfLens *lens, float focal, lfLensCalibCrop *res)
 
Definition: lensfun.h:1757
 
Definition: lensfun.h:1759
 
#define LF_EXPORT
This macro expands to an appropiate symbol visibility declaration. 
Definition: lensfun.h:64
 
void lf_camera_destroy(lfCamera *camera)
Destroy a lfCamera object. 
 
lfLens * lf_lens_new()
Create a new lens object. 
 
float Min
Minimal value that has sense. 
Definition: lensfun.h:715
 
float Max
Maximal value that has sense. 
Definition: lensfun.h:717
 
Unknown lens type. 
Definition: lensfun.h:730
 
Struct to save real focal length, which can depends on the (nominal) focal length. 
Definition: lensfun.h:687
 
cbool lf_modifier_apply_color_modification(lfModifier *modifier, void *pixels, float x, float y, int width, int height, int comp_role, int row_stride)
 
const lfCamera ** lf_db_find_cameras_ext(const lfDatabase *db, const char *maker, const char *model, int sflags)
 
float RealFocal
Real focal length. 
Definition: lensfun.h:702
 
A modifier object contains optimized data required to rectify a image. 
Definition: lensfun.h:1932
 
cbool lf_camera_check(lfCamera *camera)
 
Definition: lensfun.h:1744
 
float CropFactor
Camera crop factor (ex: 1.0). Must be defined. 
Definition: lensfun.h:311
 
const char * lf_mlstr_get(const lfMLstr str)
Get a string corresponding to current locale from a multi-language string. 
 
void lf_camera_copy(lfCamera *dest, const lfCamera *source)
Copy the data from one lfCamera structure into another. 
 
Definition: lensfun.h:116
 
This flag selects a looser search algorithm resulting in more results (still sorted by score)...
Definition: lensfun.h:1308
 
float Distance
Focus distance in meters. 
Definition: lensfun.h:614
 
void lf_lens_add_calib_distortion(lfLens *lens, const lfLensCalibDistortion *dc)
 
void lf_modifier_destroy(lfModifier *modifier)
 
float Aperture
Aperture (f-number) at which this calibration data was taken. 
Definition: lensfun.h:612
 
#define DEPRECATED
For marking deprecated functions, see http://stackoverflow.com/a/21265197. 
Definition: lensfun.h:91
 
Definition: lensfun.h:1761
 
cbool lf_modifier_apply_geometry_distortion(lfModifier *modifier, float xu, float yu, int width, int height, float *res)
 
lfCamera * lf_camera_new()
Create a new camera object. 
 
float MaxFocal
Definition: lensfun.h:791
 
Definition: lensfun.h:1704
 
void lf_mount_copy(lfMount *dest, const lfMount *source)
Copy the data from one lfMount structure into another. 
 
lfComponentRole
These constants define the role of every pixel component, four bits each. "pixel" refers here to a se...
Definition: lensfun.h:1738
 
const char * lf_get_lens_type_desc(enum lfLensType type, const char **details)
 
char ** Mounts
Definition: lensfun.h:797
 
Equirectangular. 
Definition: lensfun.h:755
 
Definition: lensfun.h:1751
 
float Focal
Focal length in mm at which this calibration data was taken. 
Definition: lensfun.h:492
 
float Focal
Definition: lensfun.h:668
 
cbool lf_lens_interpolate_tca(const lfLens *lens, float focal, lfLensCalibTCA *res)
 
void lf_lens_destroy(lfLens *lens)
Destroy a lfLens object. 
 
Definition: lensfun.h:1715
 
const lfLens ** lf_db_find_lenses(const lfDatabase *db, const lfLens *lens, int sflags)
 
void lf_db_destroy(lfDatabase *db)
Destroy the database object. 
 
Equidistant fisheye. 
Definition: lensfun.h:741
 
lfError lf_db_load_data(lfDatabase *db, const char *errcontext, const char *data, size_t data_size)
 
cbool lf_modifier_add_coord_callback_geometry(lfModifier *modifier, lfLensType from, lfLensType to, float focal)
 
void lf_modifier_add_color_callback(lfModifier *modifier, lfModifyColorFunc callback, int priority, void *data, size_t data_size)
 
Definition: lensfun.h:1726
 
No TCA correction data is known. 
Definition: lensfun.h:515
 
lfMLstr Model
Model name (ex: "Rolleiflex SL35") – same as in EXIF. 
Definition: lensfun.h:305
 
const char * lf_get_crop_desc(enum lfCropMode mode, const char **details, const lfParameter ***params)
 
lfLensCalibFov ** CalibFov
Definition: lensfun.h:825
 
lfMLstr Maker
Camera maker (ex: "Rollei") – same as in EXIF. 
Definition: lensfun.h:303
 
DEPRECATED cbool lf_lens_remove_calib_fov(lfLens *lens, int idx)
 
Definition: lensfun.h:114
 
lfDatabase * lf_db_new(void)
Create a new empty database object. 
 
cbool lf_lens_check(lfLens *lens)
 
const char * lf_get_vignetting_model_desc(enum lfVignettingModel model, const char **details, const lfParameter ***params)
 
char * Mount
Camera mount type (ex: "QBM") 
Definition: lensfun.h:309
 
char * lfMLstr
Definition: lensfun.h:108
 
A lens database object. 
Definition: lensfun.h:1345
 
cbool lf_lens_interpolate_real_focal(const lfLens *lens, float focal, lfLensCalibRealFocal *res)
 
void lf_lens_add_calib_crop(lfLens *lens, const lfLensCalibCrop *cc)
 
const lfLens *const  * lf_db_get_lenses(const lfDatabase *db)
 
Pablo D'Angelo vignetting model (which is a more general variant of the  law). 
Definition: lensfun.h:593
 
Distortion parameters are unknown. 
Definition: lensfun.h:451
 
lfMLstr Name
Camera mount name. 
Definition: lensfun.h:195
 
Lens vignetting calibration data. 
Definition: lensfun.h:605
 
cbool lf_lens_remove_calib_real_focal(lfLens *lens, int idx)
 
DEPRECATED cbool lf_lens_interpolate_fov(const lfLens *lens, float focal, lfLensCalibFov *res)
 
lfMLstr lf_mlstr_add(lfMLstr str, const char *lang, const char *trstr)
Add a new translated string to a multi-language string. 
 
No vignetting correction data is known. 
Definition: lensfun.h:583
 
void lf_lens_add_calib_vignetting(lfLens *lens, const lfLensCalibVignetting *vc)
 
lfError lf_db_save_all(const lfDatabase *db, const char *filename)
 
cbool lf_lens_interpolate_vignetting(const lfLens *lens, float focal, float aperture, float distance, lfLensCalibVignetting *res)
 
lfTCAModel
The lensfun library supports several models for lens lateral chromatic aberrations (also called trans...
Definition: lensfun.h:512
 
cbool lf_modifier_add_coord_callback_distortion(lfModifier *modifier, lfLensCalibDistortion *model, cbool reverse)
 
float Default
Default value for the parameter. 
Definition: lensfun.h:719
 
void lf_lens_add_calib_real_focal(lfLens *lens, const lfLensCalibRealFocal *cf)
 
lfMount * lf_mount_new()
Create a new mount object. 
 
lfCropMode
Different crop modes. 
Definition: lensfun.h:624
 
Struct to save calibrated field of view, which can depends on the focal length (DEPRECATED) ...
Definition: lensfun.h:665
 
lfLensCalibCrop ** CalibCrop
Definition: lensfun.h:823
 
Camera data. Unknown fields are set to NULL. 
Definition: lensfun.h:300
 
char * lf_db_save(const lfMount *const *mounts, const lfCamera *const *cameras, const lfLens *const *lenses)
 
lfMLstr lf_mlstr_dup(const lfMLstr str)
Create a complete copy of a multi-language string. 
 
lfMLstr Variant
Camera variant. Some cameras use same EXIF id for different models. 
Definition: lensfun.h:307
 
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. 
Definition: lensfun.h:1836
 
Struct to save image crop, which can depend on the focal length. 
Definition: lensfun.h:639
 
Definition: lensfun.h:1728
 
lfError lf_db_save_file(const lfDatabase *db, const char *filename, const lfMount *const *mounts, const lfCamera *const *cameras, const lfLens *const *lenses)
 
const char * Name
Parameter name (something like 'k', 'k3', 'omega' etc.) 
Definition: lensfun.h:713
 
This structure describes a single parameter for some lens model. 
Definition: lensfun.h:710
 
lfError lf_db_load(lfDatabase *db)
 
cbool lf_lens_remove_calib_distortion(lfLens *lens, int idx)
 
char * HomeDataDir
Home lens database directory (something like "~/.local/share/lensfun") 
Definition: lensfun.h:1348
 
lfLensCalibRealFocal ** CalibRealFocal
Definition: lensfun.h:827
 
float MaxAperture
Definition: lensfun.h:795