Go to the documentation of this file.
28 #if (defined(_MSC_VER) && (_MSC_VER < 1800)) // Visual studio up to VS2013 does not have stdbool.h
45 # define C_TYPEDEF(t,c)
47 # define C_TYPEDEF(t,c) typedef t c c;
63 #define LF_VERSION_MAJOR 0
65 #define LF_VERSION_MINOR 3
67 #define LF_VERSION_MICRO 95
69 #define LF_VERSION_BUGFIX 0
71 #define LF_VERSION ((LF_VERSION_MAJOR << 24) | (LF_VERSION_MINOR << 16) | (LF_VERSION_MICRO << 8) | LF_VERSION_BUGFIX)
75 #define LF_MIN_DATABASE_VERSION 0
76 #define LF_MAX_DATABASE_VERSION 2
79 #if defined CONF_LENSFUN_STATIC
83 # ifdef CONF_SYMBOL_VISIBILITY
84 # if defined PLATFORM_WINDOWS
85 # define LF_EXPORT __declspec(dllexport)
86 # elif defined CONF_COMPILER_GCC || __clang__
87 # define LF_EXPORT __attribute__((visibility("default")))
89 # error "I don't know how to change symbol visibility for your compiler"
92 # if defined PLATFORM_WINDOWS || defined _MSC_VER
93 # define LF_EXPORT __declspec(dllimport)
100 #ifndef CONF_LENSFUN_INTERNAL
103 # define DEPRECATED __attribute__((deprecated))
104 # elif defined(_MSC_VER)
105 # define DEPRECATED __declspec(deprecated)
107 # pragma message("WARNING: You need to implement DEPRECATED for this compiler")
265 void SetName (
const char *val,
const char *lang = NULL);
287 std::vector<char*> MountCompat;
411 void SetMaker (
const char *val,
const char *lang = NULL);
423 void SetModel (
const char *val,
const char *lang = NULL);
540 return CenterX == other.
CenterX &&
915 for (
auto *cb : other.CalibDistortion)
917 for (
auto *cb : other.CalibVignetting)
919 for (
auto *cb : other.CalibTCA)
921 for (
auto *cb : other.CalibCrop)
923 for (
auto *cb : other.CalibFov)
929 for (
auto cb : CalibDistortion)
931 for (
auto cb : CalibVignetting)
933 for (
auto cb : CalibTCA)
935 for (
auto cb : CalibCrop)
937 for (
auto cb : CalibFov)
943 return CalibDistortion.empty() && CalibTCA.empty() && CalibVignetting.empty() &&
944 CalibCrop.empty() && CalibFov.empty();
947 bool HasDistortion()
const {
return !CalibDistortion.empty(); }
948 bool HasTCA()
const {
return !CalibTCA.empty(); }
949 bool HasVignetting()
const {
return !CalibVignetting.empty(); }
950 bool HasCrop()
const {
return !CalibCrop.empty(); }
951 bool HasFov()
const {
return !CalibFov.empty(); }
956 std::vector<lfLensCalibDistortion*> CalibDistortion;
958 std::vector<lfLensCalibTCA*> CalibTCA;
960 std::vector<lfLensCalibVignetting*> CalibVignetting;
962 std::vector<lfLensCalibCrop*> CalibCrop;
964 std::vector<lfLensCalibFov*> CalibFov;
1125 void SetMaker (
const char *val,
const char *lang = NULL);
1137 void SetModel (
const char *val,
const char *lang = NULL);
1527 void UpdateLegacyCalibPointers();
1529 std::vector<lfLensCalibrationSet*> Calibrations;
1530 std::vector<char*> MountNames;
1891 int sflags = 0)
const;
1940 const char *model,
int sflags = 0)
const;
2037 void *fuzzycmp,
const char*
const* compat_mounts)
const;
2039 lfError Load (
const char *errcontext,
const char *data,
size_t data_size);
2041 std::vector<lfMount*> Mounts;
2042 std::vector<lfCamera*> Cameras;
2043 std::vector<lfLens*> Lenses;
2109 const char *data,
size_t data_size);
2118 const lfLens *
const *lenses);
2123 const lfLens *
const *lenses);
2127 const lfDatabase *db,
const char *maker,
const char *model);
2131 const lfDatabase *db,
const char *maker,
const char *model,
int sflags);
2139 const char *lens,
int sflags);
2144 const char *maker,
const char *lens,
int sflags);
2238 #define LF_CR_1(a) (LF_CR_ ## a)
2240 #define LF_CR_2(a,b) ((LF_CR_ ## a) | ((LF_CR_ ## b) << 4))
2242 #define LF_CR_3(a,b,c) ((LF_CR_ ## a) | ((LF_CR_ ## b) << 4) | \
2243 ((LF_CR_ ## c) << 8))
2245 #define LF_CR_4(a,b,c,d) ((LF_CR_ ## a) | ((LF_CR_ ## b) << 4) | \
2246 ((LF_CR_ ## c) << 8) | ((LF_CR_ ## d) << 12))
2248 #define LF_CR_5(a,b,c,d,e) ((LF_CR_ ## a) | ((LF_CR_ ## b) << 4) | \
2249 ((LF_CR_ ## c) << 8) | ((LF_CR_ ## d) << 12) | \
2250 ((LF_CR_ ## e) << 16))
2252 #define LF_CR_6(a,b,c,d,e,f) ((LF_CR_ ## a) | ((LF_CR_ ## b) << 4) | \
2253 ((LF_CR_ ## c) << 8) | ((LF_CR_ ## d) << 12) | \
2254 ((LF_CR_ ## e) << 16) | ((LF_CR_ ## f) << 20))
2256 #define LF_CR_7(a,b,c,d,e,f,g) ((LF_CR_ ## a) | ((LF_CR_ ## b) << 4) | \
2257 ((LF_CR_ ## c) << 8) | ((LF_CR_ ## d) << 12) | \
2258 ((LF_CR_ ## e) << 16) | ((LF_CR_ ## f) << 20) | \
2259 ((LF_CR_ ## g) << 24))
2261 #define LF_CR_8(a,b,c,d,e,f,g,h) ((LF_CR_ ## a) | ((LF_CR_ ## b) << 4) | \
2262 ((LF_CR_ ## c) << 8) | ((LF_CR_ ## d) << 12) | \
2263 ((LF_CR_ ## e) << 16) | ((LF_CR_ ## f) << 20) | \
2264 ((LF_CR_ ## g) << 24) | ((LF_CR_ ## h) << 28))
2451 float distance,
float scale,
lfLensType targeom,
int flags,
bool reverse);
2684 int comp_role,
int row_stride)
const;
2789 struct lfCallbackData
2791 virtual ~lfCallbackData() {}
2794 bool operator<(
const lfCallbackData& c)
const {
return priority < c.priority; }
2795 bool operator>(
const lfCallbackData& c)
const {
return priority > c.priority; }
2800 struct lfCallBackDataPtrComp
2802 bool operator () (
const lfCallbackData* lhs,
const lfCallbackData* rhs)
const {
2803 return lhs->priority < rhs->priority;
2822 typedef void (*lfModifySubpixCoordFunc) (
void *data,
float *iocoord,
int count);
2848 typedef void (*lfModifyColorFunc) (
void *data,
float x,
float y,
2849 void *pixels,
int comp_role,
int count);
2863 typedef void (*lfModifyCoordFunc) (
void *data,
float *iocoord,
int count);
2866 struct lfSubpixelCallback :
public lfCallbackData
2868 lfModifySubpixCoordFunc callback;
2871 struct lfSubpixTCACallback :
public lfSubpixelCallback
2873 float coordinate_correction;
2881 struct lfCoordCallback :
public lfCallbackData
2883 lfModifyCoordFunc callback;
2886 struct lfCoordDistCallbackData :
public lfCoordCallback
2888 float coordinate_correction;
2895 struct lfCoordScaleCallbackData :
public lfCoordCallback
2900 struct lfCoordGeomCallbackData :
public lfCoordCallback
2905 struct lfCoordPerspCallbackData :
public lfCoordCallback
2908 float delta_a, delta_b;
2912 struct lfColorCallback :
public lfCallbackData
2914 lfModifyColorFunc callback;
2917 struct lfColorVignCallbackData :
public lfColorCallback
2919 float coordinate_correction;
2927 std::multiset<lfSubpixelCallback*, lfCallBackDataPtrComp> SubpixelCallbacks;
2929 std::multiset<lfColorCallback*, lfCallBackDataPtrComp> ColorCallbacks;
2931 std::multiset<lfCoordCallback*, lfCallBackDataPtrComp> CoordCallbacks;
2934 typedef struct {
float angle, dist; } lfPoint;
2936 void AddSubpixTCACallback (
const lfLensCalibTCA& lcd, lfModifySubpixCoordFunc func,
int priority);
2937 void AddCoordGeomCallback (
float norm_focal, lfModifyCoordFunc func,
int priority);
2954 double AutoscaleResidualDistance (
float *coord)
const;
2969 float GetTransformedDistance (lfPoint point)
const;
2985 float GetNormalizedFocalLength (
float focal,
const lfLens* lens)
const;
2987 static void ModifyCoord_TCA_Linear (
void *data,
float *iocoord,
int count);
2988 static void ModifyCoord_UnTCA_Poly3 (
void *data,
float *iocoord,
int count);
2989 static void ModifyCoord_TCA_Poly3 (
void *data,
float *iocoord,
int count);
2990 static void ModifyCoord_TCA_ACM (
void *data,
float *iocoord,
int count);
2992 static void ModifyCoord_UnDist_Poly3 (
void *data,
float *iocoord,
int count);
2993 static void ModifyCoord_Dist_Poly3 (
void *data,
float *iocoord,
int count);
2994 #ifdef VECTORIZATION_SSE
2995 static void ModifyCoord_Dist_Poly3_SSE (
void *data,
float *iocoord,
int count);
2997 static void ModifyCoord_UnDist_Poly5 (
void *data,
float *iocoord,
int count);
2998 static void ModifyCoord_Dist_Poly5 (
void *data,
float *iocoord,
int count);
2999 static void ModifyCoord_UnDist_PTLens (
void *data,
float *iocoord,
int count);
3000 static void ModifyCoord_Dist_PTLens (
void *data,
float *iocoord,
int count);
3001 #ifdef VECTORIZATION_SSE
3002 static void ModifyCoord_UnDist_PTLens_SSE (
void *data,
float *iocoord,
int count);
3003 static void ModifyCoord_Dist_PTLens_SSE (
void *data,
float *iocoord,
int count);
3005 static void ModifyCoord_Dist_ACM (
void *data,
float *iocoord,
int count);
3006 static void ModifyCoord_Geom_FishEye_Rect (
void *data,
float *iocoord,
int count);
3007 static void ModifyCoord_Geom_Panoramic_Rect (
void *data,
float *iocoord,
int count);
3008 static void ModifyCoord_Geom_ERect_Rect (
void *data,
float *iocoord,
int count);
3009 static void ModifyCoord_Geom_Rect_FishEye (
void *data,
float *iocoord,
int count);
3010 static void ModifyCoord_Geom_Panoramic_FishEye (
void *data,
float *iocoord,
int count);
3011 static void ModifyCoord_Geom_ERect_FishEye (
void *data,
float *iocoord,
int count);
3012 static void ModifyCoord_Geom_Rect_Panoramic (
void *data,
float *iocoord,
int count);
3013 static void ModifyCoord_Geom_FishEye_Panoramic (
void *data,
float *iocoord,
int count);
3014 static void ModifyCoord_Geom_ERect_Panoramic (
void *data,
float *iocoord,
int count);
3015 static void ModifyCoord_Geom_Rect_ERect (
void *data,
float *iocoord,
int count);
3016 static void ModifyCoord_Geom_FishEye_ERect (
void *data,
float *iocoord,
int count);
3017 static void ModifyCoord_Geom_Panoramic_ERect (
void *data,
float *iocoord,
int count);
3018 static void ModifyCoord_Geom_Orthographic_ERect (
void *data,
float *iocoord,
int count);
3019 static void ModifyCoord_Geom_ERect_Orthographic (
void *data,
float *iocoord,
int count);
3020 static void ModifyCoord_Geom_Stereographic_ERect (
void *data,
float *iocoord,
int count);
3021 static void ModifyCoord_Geom_ERect_Stereographic (
void *data,
float *iocoord,
int count);
3022 static void ModifyCoord_Geom_Equisolid_ERect (
void *data,
float *iocoord,
int count);
3023 static void ModifyCoord_Geom_ERect_Equisolid (
void *data,
float *iocoord,
int count);
3024 static void ModifyCoord_Geom_Thoby_ERect (
void *data,
float *iocoord,
int count);
3025 static void ModifyCoord_Geom_ERect_Thoby (
void *data,
float *iocoord,
int count);
3026 static void ModifyCoord_Perspective_Correction (
void *data,
float *iocoord,
int count);
3027 static void ModifyCoord_Perspective_Distortion (
void *data,
float *iocoord,
int count);
3028 #ifdef VECTORIZATION_SSE
3029 static void ModifyColor_DeVignetting_PA_SSE (
3030 void *data,
float _x,
float _y,
lf_f32 *pixels,
int comp_role,
int count);
3032 #ifdef VECTORIZATION_SSE2
3033 static void ModifyColor_DeVignetting_PA_SSE2 (
3034 void *data,
float _x,
float _y,
lf_u16 *pixels,
int comp_role,
int count);
3037 template<
typename T>
static void ModifyColor_Vignetting_PA (
3038 void *data,
float x,
float y, T *rgb,
int comp_role,
int count);
3039 template<
typename T>
static void ModifyColor_DeVignetting_PA (
3040 void *data,
float x,
float y, T *rgb,
int comp_role,
int count);
3042 static void ModifyCoord_Scale (
void *data,
float *iocoord,
int count);
3044 double Width, Height;
3050 double CenterX, CenterY;
3052 double NormScale, NormUnScale;
3072 const
lfLens *lens,
float crop,
int width,
int height);
3076 float imgcrop,
int imgwidth,
int imgheight,
lfPixelFormat pixel_format,
bool reverse);
3084 float focal,
float aperture,
float distance,
float scale,
3098 lfModifier *modifier, const
lfLens* lens,
float focal,
float aperture,
float distance);
3106 lfModifier *modifier, const
lfLens* lens,
float focal,
float *x,
float *y,
int count,
float d);
3114 lfModifier *modifier,
float xu,
float yu,
int width,
int height,
float *res);
3118 lfModifier *modifier,
void *pixels,
float x,
float y,
int width,
int height,
3119 int comp_role,
int row_stride);
3123 lfModifier *modifier,
float xu,
float yu,
int width,
int height,
float *res);
3127 lfModifier *modifier,
float xu,
float yu,
int width,
int height,
float *res);
~lfModifier()
Modifier object destructor.
Lens distortion calibration data.
Definition: lensfun.h:620
void SetMount(const char *val)
Set the value for camera Mount.
@ LF_PF_F64
Definition: lensfun.h:2201
@ LF_DIST_MODEL_ACM
Adobe Camera Model. The coordinate system is different here. Everything is measured in units of the f...
Definition: lensfun.h:608
Camera data. Unknown fields are set to NULL.
Definition: lensfun.h:366
void AddLens(lfLens *lens)
Add a lens to the database.
void SetModel(const char *val, const char *lang=NULL)
Add a string to camera model.
DEPRECATED bool InterpolateDistortion(float focal, lfLensCalibDistortion &res) const
Interpolate lens geometry distortion data for given focal length.
const lfCamera ** lf_db_find_cameras(const lfDatabase *db, const char *maker, const char *model)
unsigned char lf_u8
Definition: lensfun.h:141
#define LF_EXPORT
This macro expands to an appropiate symbol visibility declaration.
Definition: lensfun.h:81
const char *const lf_db_system_location
@ LF_PF_U32
Definition: lensfun.h:2197
void lf_mount_destroy(lfMount *mount)
Destroy a lfMount object.
lfMLstr Maker
Camera maker (ex: "Rollei") – same as in EXIF.
Definition: lensfun.h:368
static const char *const SystemLocation
System lens database directory (something like "/usr/share/lensfun")
Definition: lensfun.h:1733
lfVignettingModel
The Lensfun library supports several models for lens vignetting correction.
Definition: lensfun.h:778
@ LF_WRONG_FORMAT
Definition: lensfun.h:133
@ LF_RECTILINEAR
Rectilinear lens.
Definition: lensfun.h:1000
A set of calibration data.
Definition: lensfun.h:905
lfMLstr Model
Model name (ex: "Rolleiflex SL35") – same as in EXIF.
Definition: lensfun.h:370
~lfCamera()
Destroy a camera object. All allocated fields are freed.
@ LF_SEARCH_LOOSE
This flag selects a looser search algorithm resulting in more results (still sorted by score).
Definition: lensfun.h:1690
float Aperture
Aperture (f-number) at which this calibration data was taken.
Definition: lensfun.h:820
@ LF_PF_F32
Definition: lensfun.h:2199
const lfLens *const * lf_db_get_lenses(lfDatabase *db)
@ LF_MODIFY_DISTORTION
Definition: lensfun.h:2178
DEPRECATED bool InterpolateFov(float focal, lfLensCalibFov &res) const
Interpolate lens fov data for given focal length.
void AddCalibVignetting(const lfLensCalibVignetting *lcv)
Add a new vignetting calibration structure to the pool.
bool Check()
Check if a mount object is valid.
int EnableDistortionCorrection(const lfLens *lens, float focal)
Enable distortion correction.
DEPRECATED bool RemoveCalibVignetting(int idx)
Remove a calibration entry from the vignetting calibration data.
cbool lf_modifier_apply_subpixel_distortion(lfModifier *modifier, float xu, float yu, int width, int height, float *res)
const lfCamera *const * lf_db_get_cameras(lfDatabase *db)
lfCamera * lf_camera_create()
Create a new camera object.
float Max
Maximal value that has sense.
Definition: lensfun.h:982
lfMLstr Maker
Definition: lensfun.h:1049
DEPRECATED const lfLens ** lf_db_find_lenses_hd(const lfDatabase *db, const lfCamera *camera, const char *maker, const char *lens, int sflags)
float lf_modifier_get_auto_scale(lfModifier *modifier, cbool reverse)
const lfLensCalibrationSet *const * GetCalibrationSets() const
Get a list of all calibration sets.
DEPRECATED cbool lf_db_load_directory(lfDatabase *db, const char *dirname)
lfMLstr lf_mlstr_dup(const lfMLstr str)
Create a complete copy of a multi-language string.
@ LF_CR_RED
Definition: lensfun.h:2228
unsigned int lf_u32
Definition: lensfun.h:145
lfModifier(float imgcrop, int imgwidth, int imgheight, lfPixelFormat pixel_format, bool reverse=false)
Create an empty image modifier object.
lfError
Definition: lensfun.h:129
@ LF_PF_U8
Definition: lensfun.h:2193
int lf_modifier_enable_scaling(lfModifier *modifier, float scale)
Lens vignetting calibration data.
Definition: lensfun.h:814
lfMLstr Variant
Camera variant. Some cameras use same EXIF id for different models.
Definition: lensfun.h:372
float CropFactor
Camera crop factor (ex: 1.0). Must be defined.
Definition: lensfun.h:376
@ LF_CR_UNKNOWN
Definition: lensfun.h:2224
cbool lf_lens_interpolate_tca(const lfLens *lens, float crop, float focal, lfLensCalibTCA *res)
float Focal
Definition: lensfun.h:880
void SetMaker(const char *val, const char *lang=NULL)
Add a string to camera maker.
lfLensType Type
Definition: lensfun.h:1063
#define DEPRECATED
For marking deprecated functions, see http://stackoverflow.com/a/21265197.
Definition: lensfun.h:108
@ LF_NO_CROP
no crop at all
Definition: lensfun.h:837
lfError Load(const char *data, size_t data_size)
Load a database from memory.
@ LF_DIST_MODEL_POLY5
5th order polynomial model.
Definition: lensfun.h:583
This structure describes a single parameter for some lens model.
Definition: lensfun.h:976
float CenterY
Definition: lensfun.h:531
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)
void lf_lens_destroy(lfLens *lens)
Destroy a lfLens object.
DEPRECATED lfLensCalibDistortion ** CalibDistortion
Definition: lensfun.h:1081
lfLensCalibAttributes CalibAttr
Pointer to the calibration settings (currently unused).
Definition: lensfun.h:892
float lf_f32
Definition: lensfun.h:147
float RealFocal
Real focal length in mm for this nominal focal length.
Definition: lensfun.h:655
float CenterX
Definition: lensfun.h:529
void lf_lens_add_calib_vignetting(lfLens *lens, const lfLensCalibVignetting *vc)
Laterlal chromatic aberrations calibration data.
Definition: lensfun.h:748
@ LF_TCA_MODEL_ACM
Adobe camera model for TCA. The coordinate system is different here. Everything is measured in units ...
Definition: lensfun.h:735
int EnableVignettingCorrection(const lfLens *lens, float focal, float aperture, float distance)
Enable vignetting correction.
lfTCAModel
The Lensfun library supports several models for lens lateral chromatic aberrations (also called trans...
Definition: lensfun.h:681
bool ApplySubpixelGeometryDistortion(float xu, float yu, int width, int height, float *res) const
Apply stage 2 & 3 in one step.
DEPRECATED 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)
@ LF_CR_BLUE
Definition: lensfun.h:2232
@ LF_NO_ERROR
Definition: lensfun.h:131
static const char *const UserUpdatesLocation
Home lens database directory for automatic updates (something like "~/.local/share/lensfun/updates")
Definition: lensfun.h:1731
const char *const lf_db_user_location
@ LF_TCA_MODEL_LINEAR
Linear lateral chromatic aberrations model.
Definition: lensfun.h:695
lfLensType
Lens type. See Change of projection for further information.
Definition: lensfun.h:993
float AspectRatio
Definition: lensfun.h:535
@ LF_MODIFY_TCA
Definition: lensfun.h:2173
DEPRECATED bool InterpolateFov(float crop, float focal, lfLensCalibFov &res) const
Interpolate lens fov data for given focal length.
DEPRECATED bool RemoveCalibDistortion(int idx)
Remove a calibration entry from the distortion calibration data.
@ LF_FISHEYE_STEREOGRAPHIC
Stereographic fisheye.
Definition: lensfun.h:1024
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.
lfError Load(const char *pathname)
Load the database from specific path (directory or file).
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 Lensfun library implements several lens distortion models. This enum lists them.
Definition: lensfun.h:564
float MinFocal
Definition: lensfun.h:1053
void SetModel(const char *val, const char *lang=NULL)
Add a string to camera model.
void lf_modifier_destroy(lfModifier *modifier)
void AddCalibTCA(const lfLensCalibTCA *lctca)
Add a new transversal chromatic aberration calibration structure to the pool.
char * Mount
Camera mount type (ex: "QBM")
Definition: lensfun.h:374
@ LF_CROP_CIRCLE
use a circular crop, e.g. for circular fisheye images
Definition: lensfun.h:841
lfLensCalibAttributes Attributes
Definition: lensfun.h:907
DEPRECATED lfLensCalibVignetting ** CalibVignetting
Definition: lensfun.h:1085
void lf_lens_guess_parameters(lfLens *lens)
lfLensCalibAttributes CalibAttr
Pointer to the calibration settings (currently unused).
Definition: lensfun.h:826
void AddCalibCrop(const lfLensCalibCrop *lcc)
Add a new lens crop structure to the pool.
int EnableScaling(float scale)
Enable image scaling.
cbool lf_modifier_apply_color_modification(lfModifier *modifier, void *pixels, float x, float y, int width, int height, int comp_role, int row_stride)
bool ApplySubpixelDistortion(float xu, float yu, int width, int height, float *res) const
Image correction step 3: 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:225
@ LF_PF_U16
Definition: lensfun.h:2195
const char * lf_db_mount_name(const lfDatabase *db, const char *mount)
@ LF_NO_DATABASE
Definition: lensfun.h:135
const char *const * lf_mount_get_compats(lfMount *mount)
const lfMount *const * GetMounts()
Retrieve a full list of mounts.
@ LF_SEARCH_SORT_AND_UNIQUIFY
This flag makes Lensfun to sort the results by focal length, and remove all double lens names.
Definition: lensfun.h:1702
void lf_mount_add_compat(lfMount *mount, const char *val)
@ LF_DIST_MODEL_POLY3
3rd order polynomial model, which is a subset of the PTLens model.
Definition: lensfun.h:574
@ LF_TCA_MODEL_POLY3
Third order polynomial.
Definition: lensfun.h:707
@ LF_DIST_MODEL_PTLENS
PTLens model, which is also used by Hugin.
Definition: lensfun.h:591
void lf_camera_copy(lfCamera *dest, const lfCamera *source)
Copy the data from one lfCamera structure into another.
cbool lf_lens_interpolate_vignetting(const lfLens *lens, float crop, float focal, float aperture, float distance, lfLensCalibVignetting *res)
DEPRECATED void AddCalibFov(const lfLensCalibFov *lcf)
Add a new lens fov structure to the pool.
@ LF_CROP_RECTANGLE
use a rectangular crop
Definition: lensfun.h:839
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:850
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...
lfError lf_db_load_path(lfDatabase *db, const char *pathname)
void lf_lens_remove_calibrations(lfLens *lens)
DEPRECATED bool RemoveCalibFov(int idx)
Remove a field of view entry from the lens fov structure.
const char *const lf_db_system_updates_location
float Focal
Nominal focal length in mm at which this calibration data was taken.
Definition: lensfun.h:625
int lf_modifier_enable_distortion_correction(lfModifier *modifier, const lfLens *lens, float focal)
const char * Name
Parameter name (something like 'k', 'k3', 'omega' etc.)
Definition: lensfun.h:978
@ LF_MODIFY_VIGNETTING
Definition: lensfun.h:2175
const char * lf_mlstr_get(const lfMLstr str)
Get a string corresponding to current locale from a multi-language string.
float MaxFocal
Definition: lensfun.h:1055
@ LF_FISHEYE_ORTHOGRAPHIC
Orthographic fisheye.
Definition: lensfun.h:1022
char * Save() const
Save the database into a memory array.
void lf_camera_destroy(lfCamera *camera)
Destroy a lfCamera object.
float Focal
Focal length in mm at which this calibration data was taken.
Definition: lensfun.h:852
DEPRECATED bool RemoveCalibCrop(int idx)
Remove a lens crop entry from the lens crop structure.
bool Check()
Check if a camera object is valid.
const lfLens *const * GetLenses()
Retrieve a full list of lenses.
int lf_modifier_enable_perspective_correction(lfModifier *modifier, const lfLens *lens, float focal, float *x, float *y, int count, float d)
DEPRECATED float CenterY
Definition: lensfun.h:1075
static DEPRECATED lfModifier * Create(const lfLens *lens, float crop, int width, int height)
Create an empty image modifier object.
void AddMount(lfMount *mount)
Add a mount to the database.
DEPRECATED char * UserUpdatesDir
Home lens database directory for automatic updates (deprecated). Replaced by lfDatabase::UserUpdatesL...
Definition: lensfun.h:1723
int Score
Definition: lensfun.h:1091
DEPRECATED bool InterpolateTCA(float focal, lfLensCalibTCA &res) const
Interpolate lens TCA calibration data for given focal length.
bool Check()
Check if a lens object is valid.
DEPRECATED float CenterX
Definition: lensfun.h:1073
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. "pixel" refers here to a se...
Definition: lensfun.h:2210
float Distance
Focus distance in meters.
Definition: lensfun.h:822
@ LF_FISHEYE_EQUISOLID
Equisolid fisheye.
Definition: lensfun.h:1026
const lfCamera ** FindCamerasExt(const char *maker, const char *model, int sflags=0) const
Searches all translations of camera maker and model.
DEPRECATED char ** Mounts
Definition: lensfun.h:1061
void AddCompat(const char *val)
Add a mount name to the list of compatible mounts.
cbool lf_lens_interpolate_crop(const lfLens *lens, float crop, float focal, lfLensCalibCrop *res)
@ LF_FISHEYE_THOBY
Fisheye as measured by Thoby (for Nikkor 10.5).
Definition: lensfun.h:1032
cbool lf_modifier_enable_projection_transform(lfModifier *modifier, const lfLens *lens, float focal, lfLensType target_projection)
lfError Load()
Find and load the lens database.
Lens calibration attributes.
Definition: lensfun.h:519
static long int ReadTimestamp(const char *dirname)
Scans for the timestamp of a Lensfun database.
void lf_lens_add_mount(lfLens *lens, const char *val)
This structure contains everything specific to a camera mount.
Definition: lensfun.h:219
const lfLens ** lf_db_find_lenses(const lfDatabase *db, const lfCamera *camera, const char *maker, const char *lens, int sflags)
DEPRECATED lfLensCalibCrop ** CalibCrop
Definition: lensfun.h:1087
~lfLens()
Destroy this and all associated objects.
static const char *const SystemUpdatesLocation
System lens database directory for automatic updates (something like "/var/lib/lensfun-updates")
Definition: lensfun.h:1736
void lf_lens_add_calib_distortion(lfLens *lens, const lfLensCalibDistortion *dc)
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.
@ LF_MODIFY_PERSPECTIVE
Definition: lensfun.h:2184
cbool lf_mount_check(lfMount *mount)
DEPRECATED float AspectRatio
Definition: lensfun.h:1079
@ LF_UNKNOWN
Unknown lens type.
Definition: lensfun.h:995
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 2: apply the transforms on a block of pixel coordinates.
void AddCamera(lfCamera *camera)
Add a camera to the database.
DEPRECATED lfModifier * lf_modifier_new(const lfLens *lens, float crop, int width, int height)
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.
Definition: lensfun.h:1020
float MinAperture
Definition: lensfun.h:1057
DEPRECATED lfLensCalibFov ** CalibFov
Definition: lensfun.h:1089
@ LF_MODIFY_ALL
Definition: lensfun.h:2186
const char * lf_get_distortion_model_desc(enum lfDistortionModel model, const char **details, const lfParameter ***params)
const char * lf_get_lens_type_desc(enum lfLensType type, const char **details)
lfMount * lf_mount_create()
Create a new mount object.
DEPRECATED bool LoadDirectory(const char *dirname)
Open and parse all XML files in a given directory.
long int lf_db_read_timestamp(lfDatabase *db, const char *dirname)
float FieldOfView
Field of view for given images.
Definition: lensfun.h:890
@ LF_CR_INTENSITY
Definition: lensfun.h:2226
bool InterpolateDistortion(float crop, float focal, lfLensCalibDistortion &res) const
Interpolate lens geometry distortion data for given focal length and crop factor.
DEPRECATED char ** Compat
Definition: lensfun.h:227
#define C_TYPEDEF(t, c)
Definition: lensfun.h:45
const char *const * GetMountNames() const
Get a list of all mount names.
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:984
float MaxAperture
Definition: lensfun.h:1059
DEPRECATED bool RemoveCalibTCA(int idx)
Remove a calibration entry from the TCA calibration data.
void lf_db_destroy(lfDatabase *db)
Destroy the database object.
DEPRECATED bool InterpolateCrop(float focal, lfLensCalibCrop &res) const
Interpolate lens crop data for given focal length.
lfCropMode
Different crop modes.
Definition: lensfun.h:835
int EnableTCACorrection(const lfLens *lens, float focal)
Enable TCA correction.
cbool lf_lens_interpolate_distortion(const lfLens *lens, float crop, float focal, lfLensCalibDistortion *res)
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:683
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 ...
char * lfMLstr
Definition: lensfun.h:125
@ LF_CR_GREEN
Definition: lensfun.h:2230
const lfCamera *const * GetCameras()
Retrieve a full list of cameras.
int EnableDistortionCorrection(const lfLensCalibDistortion &lcd)
Enable distortion correction.
void lf_mount_copy(lfMount *dest, const lfMount *source)
Copy the data from one lfMount structure into another.
const char *const lf_db_user_updates_location
lfMLstr Model
Definition: lensfun.h:1051
DEPRECATED 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.
DEPRECATED cbool lf_lens_interpolate_fov(const lfLens *lens, float crop, float focal, lfLensCalibFov *res)
DEPRECATED void lf_lens_add_calib_fov(lfLens *lens, const lfLensCalibFov *cf)
lfLensCalibAttributes CalibAttr
Pointer to the calibration settings (currently unused).
Definition: lensfun.h:865
float GetAutoScale(bool reverse)
Compute the automatic scale factor for the image.
A lens database object.
Definition: lensfun.h:1719
@ LF_CR_NEXT
Definition: lensfun.h:2222
lfPixelFormat
A list of pixel formats supported by internal colour callbacks.
Definition: lensfun.h:2191
@ LF_FISHEYE
Equidistant fisheye.
Definition: lensfun.h:1006
lfLens * lf_lens_create()
Create a new lens object.
@ LF_DIST_MODEL_NONE
Distortion parameters are unknown.
Definition: lensfun.h:566
const lfMount *const * lf_db_get_mounts(lfDatabase *db)
DEPRECATED void Destroy()
Destroy the database object and free all loaded data.
cbool RealFocalMeasured
Whether the real focal length was actually measured.
Definition: lensfun.h:658
lfError lf_db_load_data(lfDatabase *db, const char *errcontext, const char *data, size_t data_size)
lfDatabase * lf_db_create(void)
Create a new empty database object.
static DEPRECATED lfDatabase * Create()
Create a new empty database object.
@ LF_VIGNETTING_MODEL_PA
Pablo D'Angelo vignetting model (which is a more general variant of the law).
Definition: lensfun.h:790
const char *const * lf_lens_get_mount_names(lfLens *lens)
int lf_modifier_enable_vignetting_correction(lfModifier *modifier, const lfLens *lens, float focal, float aperture, float distance)
double lf_f64
Definition: lensfun.h:149
unsigned short lf_u16
Definition: lensfun.h:143
bool InterpolateCrop(float crop, float focal, lfLensCalibCrop &res) const
Interpolate lens crop data for given focal length.
float CropFactor
Definition: lensfun.h:533
int Score
Camera matching score, used while searching: not actually a camera parameter.
Definition: lensfun.h:378
lfDatabase()
Database object constructor.
const lfMount * FindMount(const char *mount) const
Return the lfMount structure given the (basic) mount name.
cbool lf_camera_check(lfCamera *camera)
int EnableTCACorrection(const lfLensCalibTCA &lctca)
Enable TCA correction.
lfError Save(const char *filename) const
Save the whole database to a file.
lfModifier * lf_modifier_create(float imgcrop, int imgwidth, int imgheight, lfPixelFormat pixel_format, bool reverse)
static const char *const UserLocation
Home lens database directory (something like "~/.local/share/lensfun")
Definition: lensfun.h:1728
cbool lf_modifier_apply_geometry_distortion(lfModifier *modifier, float xu, float yu, int width, int height, float *res)
lfError lf_db_save_all(const lfDatabase *db, const char *filename)
lfCamera()
Initialize a new camera object. All fields are set to 0.
DEPRECATED lfModifier(const lfLens *lens, float crop, int width, int height)
Create an empty image modifier object.
DEPRECATED lfLens * lf_lens_new()
Create a new lens object.
bool InterpolateTCA(float crop, float focal, lfLensCalibTCA &res) const
Interpolate lens TCA calibration data for given focal length.
#define cbool
C-compatible bool type; don't bother to define Yet Another Boolean Type.
Definition: lensfun.h:115
void GuessParameters()
This method fills some fields if they are missing but can be derived from other fields.
Lens data. Unknown fields are set to NULL or 0.
Definition: lensfun.h:1047
int EnablePerspectiveCorrection(const lfLens *lens, float focal, float *x, float *y, int count, float d)
Enable the perspective correction.
cbool lf_lens_remove_calib_distortion(lfLens *lens, int idx)
~lfMount()
Destroy a mount object. All allocated fields are freed.
lfLens(const lfLens &other)
@ LF_VIGNETTING_MODEL_ACM
Adobe's vignetting model. It differs from D'Angelo's model only in the coordinate system....
Definition: lensfun.h:801
DEPRECATED lfDatabase * lf_db_new(void)
Create a new empty database object.
DEPRECATED void Destroy()
Destroy the modifier object.
lfMount()
Initialize a new mount object. All fields are set to 0.
DEPRECATED bool InterpolateVignetting(float focal, float aperture, float distance, lfLensCalibVignetting &res) const
Interpolate lens vignetting model parameters for given focal length, aperture, and focus distance.
void AddCalibDistortion(const lfLensCalibDistortion *lcd)
Add a new distortion calibration structure to the pool.
char * lf_db_save(const lfMount *const *mounts, const lfCamera *const *cameras, const lfLens *const *lenses)
float Focal
Focal length in mm at which this calibration data was taken.
Definition: lensfun.h:818
void RemoveCalibrations()
Remove all calibrations from the lens.
lfLens()
Create a new lens object, initializing all fields to default values.
DEPRECATED lfMount * lf_mount_new()
Create a new mount object.
DEPRECATED lfLensCalibTCA ** CalibTCA
Definition: lensfun.h:1083
const char * lf_get_crop_desc(enum lfCropMode mode, const char **details, const lfParameter ***params)
float Focal
Focal length in mm at which this calibration data was taken.
Definition: lensfun.h:752
cbool lf_lens_remove_calib_crop(lfLens *lens, int idx)
DEPRECATED cbool lf_lens_remove_calib_fov(lfLens *lens, int idx)
DEPRECATED float CropFactor
Definition: lensfun.h:1077
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
Definition: lensfun.h:2180
@ LF_VIGNETTING_MODEL_NONE
No vignetting correction data is known.
Definition: lensfun.h:780
@ LF_MODIFY_SCALE
Definition: lensfun.h:2182
const char * MountName(const char *mount) const
Get the name of a mount in current locale.
DEPRECATED lfError lf_db_load_file(lfDatabase *db, const char *filename)
lfMLstr lf_mlstr_add(lfMLstr str, const char *lang, const char *trstr)
Add a new translated string to a multi-language string.
DEPRECATED lfCamera * lf_camera_new()
Create a new camera object.
float Min
Minimal value that has sense.
Definition: lensfun.h:980
lfError lf_db_load(lfDatabase *db)
int EnableVignettingCorrection(const lfLensCalibVignetting &lcv)
Enable vignetting correction.
cbool lf_lens_check(lfLens *lens)
lfMount(const lfMount &other)
const char * lf_get_vignetting_model_desc(enum lfVignettingModel model, const char **details, const lfParameter ***params)
int EnableProjectionTransform(const lfLens *lens, float focal, lfLensType target_projection)
Enable projection transform.
A modifier object contains optimized data required to rectify a image.
Definition: lensfun.h:2351
DEPRECATED char * HomeDataDir
Home lens database directory (deprecated). Replaced by lfDatabase::UserLocation.
Definition: lensfun.h:1721
@ LF_PANORAMIC
Panoramic (cylindrical)
Definition: lensfun.h:1013
int lf_modifier_enable_tca_correction(lfModifier *modifier, const lfLens *lens, float focal)
bool ApplyColorModification(void *pixels, float x, float y, int width, int height, int comp_role, int row_stride) const
Image correction step 1: fix image colors.
void lf_lens_add_calib_crop(lfLens *lens, const lfLensCalibCrop *cc)
const char *const * GetCompats() const
Return a list of compatible mounts.
cbool lf_lens_remove_calib_tca(lfLens *lens, int idx)
Struct to save calibrated field of view, which can depends on the focal length (DEPRECATED)
Definition: lensfun.h:878
lfCamera(const lfCamera &other)
@ LF_CR_END
Definition: lensfun.h:2215
~lfDatabase()
Database object destructor.