30 # define C_TYPEDEF(t,c)
32 # define C_TYPEDEF(t,c) typedef t c c;
49 #define LF_VERSION_MAJOR 0
51 #define LF_VERSION_MINOR 3
53 #define LF_VERSION_MICRO 3
55 #define LF_VERSION_BUGFIX 0
57 #define LF_VERSION ((LF_VERSION_MAJOR << 24) | (LF_VERSION_MINOR << 16) | (LF_VERSION_MICRO << 8) | LF_VERSION_BUGFIX)
60 #define LF_MIN_DATABASE_VERSION 0
62 #define LF_MAX_DATABASE_VERSION 1
64 #if defined CONF_LENSFUN_STATIC
68 # ifdef CONF_SYMBOL_VISIBILITY
69 # if defined PLATFORM_WINDOWS
70 # define LF_EXPORT __declspec(dllexport)
71 # elif defined CONF_COMPILER_GCC || __clang__
72 # define LF_EXPORT __attribute__((visibility("default")))
74 # error "I don't know how to change symbol visibility for your compiler"
77 # if defined PLATFORM_WINDOWS || defined _MSC_VER
78 # define LF_EXPORT __declspec(dllimport)
85 #ifndef CONF_LENSFUN_INTERNAL
88 # define DEPRECATED __attribute__((deprecated))
89 # elif defined(_MSC_VER)
90 # define DEPRECATED __declspec(deprecated)
92 # pragma message("WARNING: You need to implement DEPRECATED for this compiler")
245 void SetName (
const char *val,
const char *lang = NULL);
366 void SetMaker (
const char *val,
const char *lang = NULL);
378 void SetModel (
const char *val,
const char *lang = NULL);
881 void SetMaker (
const char *val,
const char *lang = NULL);
893 void SetModel (
const char *val,
const char *lang = NULL);
1437 lfError Load (
const char *errcontext,
const char *data,
size_t data_size);
1464 const lfLens *
const *lenses)
const;
1480 const lfLens *
const *lenses);
1529 int sflags = 0)
const;
1578 const char *model,
int sflags = 0)
const;
1699 const
char *data,
size_t data_size);
1708 const
lfLens *const *lenses);
1713 const
lfLens *const *lenses);
1717 const
lfDatabase *db, const
char *maker, const
char *model);
1721 const
lfDatabase *db, const
char *maker, const
char *model,
int sflags);
1729 const
char *lens,
int sflags);
1825 #define LF_CR_1(a) (LF_CR_ ## a)
1827 #define LF_CR_2(a,b) ((LF_CR_ ## a) | ((LF_CR_ ## b) << 4))
1829 #define LF_CR_3(a,b,c) ((LF_CR_ ## a) | ((LF_CR_ ## b) << 4) | \
1830 ((LF_CR_ ## c) << 8))
1832 #define LF_CR_4(a,b,c,d) ((LF_CR_ ## a) | ((LF_CR_ ## b) << 4) | \
1833 ((LF_CR_ ## c) << 8) | ((LF_CR_ ## d) << 12))
1835 #define LF_CR_5(a,b,c,d,e) ((LF_CR_ ## a) | ((LF_CR_ ## b) << 4) | \
1836 ((LF_CR_ ## c) << 8) | ((LF_CR_ ## d) << 12) | \
1837 ((LF_CR_ ## e) << 16))
1839 #define LF_CR_6(a,b,c,d,e,f) ((LF_CR_ ## a) | ((LF_CR_ ## b) << 4) | \
1840 ((LF_CR_ ## c) << 8) | ((LF_CR_ ## d) << 12) | \
1841 ((LF_CR_ ## e) << 16) | ((LF_CR_ ## f) << 20))
1843 #define LF_CR_7(a,b,c,d,e,f,g) ((LF_CR_ ## a) | ((LF_CR_ ## b) << 4) | \
1844 ((LF_CR_ ## c) << 8) | ((LF_CR_ ## d) << 12) | \
1845 ((LF_CR_ ## e) << 16) | ((LF_CR_ ## f) << 20) | \
1846 ((LF_CR_ ## g) << 24))
1848 #define LF_CR_8(a,b,c,d,e,f,g,h) ((LF_CR_ ## a) | ((LF_CR_ ## b) << 4) | \
1849 ((LF_CR_ ## c) << 8) | ((LF_CR_ ## d) << 12) | \
1850 ((LF_CR_ ## e) << 16) | ((LF_CR_ ## f) << 20) | \
1851 ((LF_CR_ ## g) << 24) | ((LF_CR_ ## h) << 28))
1895 void *pixels,
int comp_role,
int count);
1915 struct lfCallbackData
1921 virtual ~lfCallbackData() {};
1925 typedef struct {
float angle, dist; } lfPoint;
2117 float distance,
float scale,
lfLensType targeom,
int flags,
bool reverse);
2144 void *data,
size_t data_size);
2164 void *data,
size_t data_size);
2183 void *data,
size_t data_size);
2216 bool reverse =
false);
2312 int comp_role,
int row_stride)
const;
2445 float GetRealFocalLength (
const lfLens *lens,
float focal);
2447 void AddCallback (
void *arr, lfCallbackData *d,
2448 int priority,
void *data,
size_t data_size);
2463 double AutoscaleResidualDistance (
float *coord)
const;
2478 float GetTransformedDistance (lfPoint point)
const;
2480 static void ModifyCoord_UnTCA_Linear (
void *data,
float *iocoord,
int count);
2481 static void ModifyCoord_TCA_Linear (
void *data,
float *iocoord,
int count);
2482 static void ModifyCoord_UnTCA_Poly3 (
void *data,
float *iocoord,
int count);
2483 static void ModifyCoord_TCA_Poly3 (
void *data,
float *iocoord,
int count);
2485 static void ModifyCoord_UnDist_Poly3 (
void *data,
float *iocoord,
int count);
2486 static void ModifyCoord_Dist_Poly3 (
void *data,
float *iocoord,
int count);
2487 #ifdef VECTORIZATION_SSE
2488 static void ModifyCoord_Dist_Poly3_SSE (
void *data,
float *iocoord,
int count);
2490 static void ModifyCoord_UnDist_Poly5 (
void *data,
float *iocoord,
int count);
2491 static void ModifyCoord_Dist_Poly5 (
void *data,
float *iocoord,
int count);
2492 static void ModifyCoord_UnDist_PTLens (
void *data,
float *iocoord,
int count);
2493 static void ModifyCoord_Dist_PTLens (
void *data,
float *iocoord,
int count);
2494 #ifdef VECTORIZATION_SSE
2495 static void ModifyCoord_UnDist_PTLens_SSE (
void *data,
float *iocoord,
int count);
2496 static void ModifyCoord_Dist_PTLens_SSE (
void *data,
float *iocoord,
int count);
2498 static void ModifyCoord_Geom_FishEye_Rect (
void *data,
float *iocoord,
int count);
2499 static void ModifyCoord_Geom_Panoramic_Rect (
void *data,
float *iocoord,
int count);
2500 static void ModifyCoord_Geom_ERect_Rect (
void *data,
float *iocoord,
int count);
2501 static void ModifyCoord_Geom_Rect_FishEye (
void *data,
float *iocoord,
int count);
2502 static void ModifyCoord_Geom_Panoramic_FishEye (
void *data,
float *iocoord,
int count);
2503 static void ModifyCoord_Geom_ERect_FishEye (
void *data,
float *iocoord,
int count);
2504 static void ModifyCoord_Geom_Rect_Panoramic (
void *data,
float *iocoord,
int count);
2505 static void ModifyCoord_Geom_FishEye_Panoramic (
void *data,
float *iocoord,
int count);
2506 static void ModifyCoord_Geom_ERect_Panoramic (
void *data,
float *iocoord,
int count);
2507 static void ModifyCoord_Geom_Rect_ERect (
void *data,
float *iocoord,
int count);
2508 static void ModifyCoord_Geom_FishEye_ERect (
void *data,
float *iocoord,
int count);
2509 static void ModifyCoord_Geom_Panoramic_ERect (
void *data,
float *iocoord,
int count);
2510 static void ModifyCoord_Geom_Orthographic_ERect (
void *data,
float *iocoord,
int count);
2511 static void ModifyCoord_Geom_ERect_Orthographic (
void *data,
float *iocoord,
int count);
2512 static void ModifyCoord_Geom_Stereographic_ERect (
void *data,
float *iocoord,
int count);
2513 static void ModifyCoord_Geom_ERect_Stereographic (
void *data,
float *iocoord,
int count);
2514 static void ModifyCoord_Geom_Equisolid_ERect (
void *data,
float *iocoord,
int count);
2515 static void ModifyCoord_Geom_ERect_Equisolid (
void *data,
float *iocoord,
int count);
2516 static void ModifyCoord_Geom_Thoby_ERect (
void *data,
float *iocoord,
int count);
2517 static void ModifyCoord_Geom_ERect_Thoby (
void *data,
float *iocoord,
int count);
2518 #ifdef VECTORIZATION_SSE
2519 static void ModifyColor_DeVignetting_PA_SSE (
2520 void *data,
float _x,
float _y,
lf_f32 *pixels,
int comp_role,
int count);
2522 #ifdef VECTORIZATION_SSE2
2523 static void ModifyColor_DeVignetting_PA_SSE2 (
2524 void *data,
float _x,
float _y,
lf_u16 *pixels,
int comp_role,
int count);
2527 template<
typename T>
static void ModifyColor_Vignetting_PA (
2528 void *data,
float x,
float y, T *rgb,
int comp_role,
int count);
2529 template<
typename T>
static void ModifyColor_DeVignetting_PA (
2530 void *data,
float x,
float y, T *rgb,
int comp_role,
int count);
2532 static void ModifyCoord_Scale (
void *data,
float *iocoord,
int count);
2537 double CenterX, CenterY;
2539 double NormScale, NormUnScale;
2542 double NormalizedInMillimeters;
2545 double AspectRatioCorrection;
2548 void *SubpixelCallbacks;
2550 void *ColorCallbacks;
2552 void *CoordCallbacks;
2566 const
lfLens *lens,
float crop,
int width,
int height);
2574 float focal,
float aperture,
float distance,
float scale,
2580 void *data,
size_t data_size);
2585 void *data,
size_t data_size);
2590 void *data,
size_t data_size);
2619 lfModifier *modifier,
float xu,
float yu,
int width,
int height,
float *res);
2623 lfModifier *modifier,
void *pixels,
float x,
float y,
int width,
int height,
2624 int comp_role,
int row_stride);
2628 lfModifier *modifier,
float xu,
float yu,
int width,
int height,
float *res);
2632 lfModifier *modifier,
float xu,
float yu,
int width,
int height,
float *res);
lfMLstr lf_mlstr_dup(const lfMLstr str)
Create a complete copy of a multi-language string.
unsigned char lf_u8
Definition: lensfun.h:126
char * lfMLstr
Definition: lensfun.h:110
unsigned short lf_u16
Definition: lensfun.h:128
const char * lf_mlstr_get(const lfMLstr str)
Get a string corresponding to current locale from a multi-language string.
#define LF_EXPORT
This macro expands to an appropiate symbol visibility declaration.
Definition: lensfun.h:66
double lf_f64
Definition: lensfun.h:134
#define DEPRECATED
For marking deprecated functions, see http://stackoverflow.com/a/21265197.
Definition: lensfun.h:93
unsigned int lf_u32
Definition: lensfun.h:130
float lf_f32
Definition: lensfun.h:132
#define cbool
C-compatible bool type; don't bother to define Yet Another Boolean Type.
Definition: lensfun.h:100
lfMLstr lf_mlstr_add(lfMLstr str, const char *lang, const char *trstr)
Add a new translated string to a multi-language string.
lfError
Definition: lensfun.h:114
@ LF_NO_ERROR
Definition: lensfun.h:116
@ LF_NO_DATABASE
Definition: lensfun.h:120
@ LF_WRONG_FORMAT
Definition: lensfun.h:118
void lf_camera_copy(lfCamera *dest, const lfCamera *source)
Copy the data from one lfCamera structure into another.
cbool lf_camera_check(lfCamera *camera)
lfCamera * lf_camera_new()
Create a new camera object.
void lf_camera_destroy(lfCamera *camera)
Destroy a lfCamera object.
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:1868
cbool lf_modifier_apply_subpixel_distortion(lfModifier *modifier, float xu, float yu, int width, int height, float *res)
void lf_modifier_add_coord_callback(lfModifier *modifier, lfModifyCoordFunc callback, int priority, void *data, size_t data_size)
void lf_modifier_destroy(lfModifier *modifier)
cbool lf_modifier_add_coord_callback_scale(lfModifier *modifier, float scale, cbool reverse)
cbool lf_modifier_apply_color_modification(lfModifier *modifier, void *pixels, float x, float y, int width, int height, int comp_role, int row_stride)
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)
float lf_modifier_get_auto_scale(lfModifier *modifier, cbool reverse)
void(* lfModifyCoordFunc)(void *data, float *iocoord, int count)
A callback function which modifies the coordinates of a strip of pixels.
Definition: lensfun.h:1909
lfModifier * lf_modifier_new(const lfLens *lens, float crop, int width, int height)
cbool lf_modifier_apply_geometry_distortion(lfModifier *modifier, float xu, float yu, int width, int height, float *res)
void lf_modifier_add_color_callback(lfModifier *modifier, lfModifyColorFunc callback, int priority, void *data, size_t data_size)
cbool lf_modifier_apply_subpixel_geometry_distortion(lfModifier *modifier, float xu, float yu, int width, int height, float *res)
cbool lf_modifier_add_coord_callback_distortion(lfModifier *modifier, lfLensCalibDistortion *model, cbool reverse)
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)
cbool lf_modifier_add_subpixel_callback_TCA(lfModifier *modifier, lfLensCalibTCA *model, cbool reverse)
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:1894
cbool lf_modifier_add_coord_callback_geometry(lfModifier *modifier, lfLensType from, lfLensType to, float focal)
lfComponentRole
These constants define the role of every pixel component, four bits each. "pixel" refers here to a se...
Definition: lensfun.h:1797
lfPixelFormat
A list of pixel formats supported by internal colour callbacks.
Definition: lensfun.h:1778
@ LF_MODIFY_TCA
Definition: lensfun.h:1762
@ LF_MODIFY_VIGNETTING
Definition: lensfun.h:1764
@ LF_MODIFY_GEOMETRY
Definition: lensfun.h:1769
@ LF_MODIFY_DISTORTION
Definition: lensfun.h:1767
@ LF_MODIFY_SCALE
Definition: lensfun.h:1771
@ LF_MODIFY_ALL
Definition: lensfun.h:1773
@ LF_CR_NEXT
Definition: lensfun.h:1809
@ LF_CR_END
Definition: lensfun.h:1802
@ LF_CR_INTENSITY
Definition: lensfun.h:1813
@ LF_CR_RED
Definition: lensfun.h:1815
@ LF_CR_UNKNOWN
Definition: lensfun.h:1811
@ LF_CR_GREEN
Definition: lensfun.h:1817
@ LF_CR_BLUE
Definition: lensfun.h:1819
@ LF_PF_U16
Definition: lensfun.h:1782
@ LF_PF_F64
Definition: lensfun.h:1788
@ LF_PF_U8
Definition: lensfun.h:1780
@ LF_PF_U32
Definition: lensfun.h:1784
@ LF_PF_F32
Definition: lensfun.h:1786
const lfCamera ** lf_db_find_cameras(const lfDatabase *db, const char *maker, const char *model)
const lfLens *const * lf_db_get_lenses(const lfDatabase *db)
const lfLens ** lf_db_find_lenses_hd(const lfDatabase *db, const lfCamera *camera, const char *maker, const char *lens, int sflags)
lfError lf_db_load_data(lfDatabase *db, const char *errcontext, const char *data, size_t data_size)
lfError lf_db_load(lfDatabase *db)
const lfMount *const * lf_db_get_mounts(const lfDatabase *db)
cbool lf_db_load_directory(lfDatabase *db, const char *dirname)
lfError lf_db_save_all(const lfDatabase *db, const char *filename)
lfError lf_db_save_file(const lfDatabase *db, const char *filename, const lfMount *const *mounts, const lfCamera *const *cameras, const lfLens *const *lenses)
const lfCamera *const * lf_db_get_cameras(const lfDatabase *db)
const lfLens ** lf_db_find_lenses(const lfDatabase *db, const lfLens *lens, int sflags)
const char * lf_db_mount_name(const lfDatabase *db, const char *mount)
const lfMount * lf_db_find_mount(const lfDatabase *db, const char *mount)
const lfCamera ** lf_db_find_cameras_ext(const lfDatabase *db, const char *maker, const char *model, int sflags)
lfError lf_db_load_file(lfDatabase *db, const char *filename)
char * lf_db_save(const lfMount *const *mounts, const lfCamera *const *cameras, const lfLens *const *lenses)
void lf_db_destroy(lfDatabase *db)
Destroy the database object.
lfDatabase * lf_db_new(void)
Create a new empty database object.
@ LF_SEARCH_LOOSE
This flag selects a looser search algorithm resulting in more results (still sorted by score).
Definition: lensfun.h:1327
@ 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:1339
cbool lf_lens_interpolate_vignetting(const lfLens *lens, float focal, float aperture, float distance, lfLensCalibVignetting *res)
void lf_lens_add_calib_crop(lfLens *lens, const lfLensCalibCrop *cc)
lfTCAModel
The Lensfun library supports several models for lens lateral chromatic aberrations (also called trans...
Definition: lensfun.h:533
cbool lf_lens_remove_calib_real_focal(lfLens *lens, int idx)
void lf_lens_add_calib_vignetting(lfLens *lens, const lfLensCalibVignetting *vc)
cbool lf_lens_check(lfLens *lens)
DEPRECATED cbool lf_lens_remove_calib_fov(lfLens *lens, int idx)
cbool lf_lens_remove_calib_crop(lfLens *lens, int idx)
cbool lf_lens_interpolate_crop(const lfLens *lens, float focal, lfLensCalibCrop *res)
DEPRECATED void lf_lens_add_calib_fov(lfLens *lens, const lfLensCalibFov *cf)
void lf_lens_add_calib_distortion(lfLens *lens, const lfLensCalibDistortion *dc)
void lf_lens_destroy(lfLens *lens)
Destroy a lfLens object.
cbool lf_lens_remove_calib_vignetting(lfLens *lens, int idx)
lfVignettingModel
The Lensfun library supports several models for lens vignetting correction.
Definition: lensfun.h:601
cbool lf_lens_remove_calib_tca(lfLens *lens, int idx)
const char * lf_get_crop_desc(enum lfCropMode mode, const char **details, const lfParameter ***params)
void lf_lens_guess_parameters(lfLens *lens)
cbool lf_lens_interpolate_distortion(const lfLens *lens, float focal, lfLensCalibDistortion *res)
cbool lf_lens_interpolate_tca(const lfLens *lens, float focal, lfLensCalibTCA *res)
const char * lf_get_lens_type_desc(enum lfLensType type, const char **details)
lfCropMode
Different crop modes.
Definition: lensfun.h:645
lfLens * lf_lens_new()
Create a new lens object.
DEPRECATED cbool lf_lens_interpolate_fov(const lfLens *lens, float focal, lfLensCalibFov *res)
const char * lf_get_tca_model_desc(enum lfTCAModel model, const char **details, const lfParameter ***params)
lfDistortionModel
The Lensfun library implements several lens distortion models. This enum lists them.
Definition: lensfun.h:469
void lf_lens_copy(lfLens *dest, const lfLens *source)
Copy the data from one lfLens structure into another.
lfLensType
Lens type. See Change of projection for further information.
Definition: lensfun.h:748
cbool lf_lens_interpolate_real_focal(const lfLens *lens, float focal, lfLensCalibRealFocal *res)
const char * lf_get_vignetting_model_desc(enum lfVignettingModel model, const char **details, const lfParameter ***params)
void lf_lens_add_calib_tca(lfLens *lens, const lfLensCalibTCA *tcac)
const char * lf_get_distortion_model_desc(enum lfDistortionModel model, const char **details, const lfParameter ***params)
void lf_lens_add_calib_real_focal(lfLens *lens, const lfLensCalibRealFocal *cf)
cbool lf_lens_remove_calib_distortion(lfLens *lens, int idx)
@ LF_TCA_MODEL_NONE
No TCA correction data is known.
Definition: lensfun.h:535
@ LF_TCA_MODEL_LINEAR
Linear lateral chromatic aberrations model.
Definition: lensfun.h:547
@ LF_TCA_MODEL_POLY3
Third order polynomial.
Definition: lensfun.h:560
@ LF_VIGNETTING_MODEL_PA
Pablo D'Angelo vignetting model (which is a more general variant of the law).
Definition: lensfun.h:613
@ LF_VIGNETTING_MODEL_NONE
No vignetting correction data is known.
Definition: lensfun.h:603
@ LF_CROP_RECTANGLE
use a rectangular crop
Definition: lensfun.h:649
@ LF_CROP_CIRCLE
use a circular crop, e.g. for circular fisheye images
Definition: lensfun.h:651
@ LF_NO_CROP
no crop at all
Definition: lensfun.h:647
@ LF_DIST_MODEL_POLY5
5th order polynomial model.
Definition: lensfun.h:488
@ LF_DIST_MODEL_NONE
Distortion parameters are unknown.
Definition: lensfun.h:471
@ LF_DIST_MODEL_PTLENS
PTLens model, which is also used by Hugin.
Definition: lensfun.h:496
@ LF_DIST_MODEL_POLY3
3rd order polynomial model, which is a subset of the PTLens model.
Definition: lensfun.h:479
@ LF_FISHEYE
Equidistant fisheye.
Definition: lensfun.h:761
@ LF_FISHEYE_EQUISOLID
Equisolid fisheye.
Definition: lensfun.h:781
@ LF_FISHEYE_THOBY
Fisheye as measured by Thoby (for Nikkor 10.5).
Definition: lensfun.h:787
@ LF_UNKNOWN
Unknown lens type.
Definition: lensfun.h:750
@ LF_FISHEYE_ORTHOGRAPHIC
Orthographic fisheye.
Definition: lensfun.h:777
@ LF_EQUIRECTANGULAR
Equirectangular.
Definition: lensfun.h:775
@ LF_RECTILINEAR
Rectilinear lens.
Definition: lensfun.h:755
@ LF_FISHEYE_STEREOGRAPHIC
Stereographic fisheye.
Definition: lensfun.h:779
@ LF_PANORAMIC
Panoramic (cylindrical)
Definition: lensfun.h:768
lfMount * lf_mount_new()
Create a new mount object.
void lf_mount_destroy(lfMount *mount)
Destroy a lfMount object.
void lf_mount_copy(lfMount *dest, const lfMount *source)
Copy the data from one lfMount structure into another.
cbool lf_mount_check(lfMount *mount)
#define C_TYPEDEF(t, c)
Definition: lensfun.h:30
Camera data. Unknown fields are set to NULL.
Definition: lensfun.h:321
lfMLstr Model
Model name (ex: "Rolleiflex SL35") – same as in EXIF.
Definition: lensfun.h:325
lfMLstr Variant
Camera variant. Some cameras use same EXIF id for different models.
Definition: lensfun.h:327
~lfCamera()
Destroy a camera object. All allocated fields are freed.
int Score
Camera matching score, used while searching: not actually a camera parameter.
Definition: lensfun.h:333
bool Check()
Check if a camera object is valid.
lfMLstr Maker
Camera maker (ex: "Rollei") – same as in EXIF.
Definition: lensfun.h:323
void SetVariant(const char *val, const char *lang=NULL)
Add a string to camera variant.
lfCamera(const lfCamera &other)
lfCamera()
Initialize a new camera object. All fields are set to 0.
void SetMaker(const char *val, const char *lang=NULL)
Add a string to camera maker.
char * Mount
Camera mount type (ex: "QBM")
Definition: lensfun.h:329
void SetMount(const char *val)
Set the value for camera Mount.
void SetModel(const char *val, const char *lang=NULL)
Add a string to camera model.
float CropFactor
Camera crop factor (ex: 1.0). Must be defined.
Definition: lensfun.h:331
A lens database object.
Definition: lensfun.h:1362
lfError Save(const char *filename) const
Save the whole database to a file.
const lfMount * FindMount(const char *mount) const
Return the lfMount structure given the (basic) mount name.
void AddMount(lfMount *mount)
Add a mount to the database.
const lfCamera ** FindCameras(const char *maker, const char *model) const
Find a set of cameras that fit given criteria.
bool LoadDirectory(const char *dirname)
Open and parse all XML files in a given directory.
const lfLens *const * GetLenses() const
Retrieve a full list of lenses.
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....
char * HomeDataDir
Home lens database directory (something like "~/.local/share/lensfun")
Definition: lensfun.h:1364
static DEPRECATED lfDatabase * Create()
Create a new empty database object. This function is deprecated and will be removed in the future....
const lfMount *const * GetMounts() const
Retrieve a full list of mounts.
const lfLens ** FindLenses(const lfLens *lens, int sflags=0) const
Find a set of lenses that fit certain criteria.
lfError Load(const char *filename)
Load just a specific XML file.
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.
char * UserUpdatesDir
Home lens database directory for automatic updates (something like "~/.local/share/lensfun/updates")
Definition: lensfun.h:1367
void AddCamera(lfCamera *camera)
Add a camera to the database.
const char * MountName(const char *mount) const
Get the name of a mount in current locale.
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.
const lfCamera ** FindCamerasExt(const char *maker, const char *model, int sflags=0) const
Searches all translations of camera maker and model.
DEPRECATED void Destroy()
Destroy the database object and free all loaded data.
lfError Load(const char *errcontext, const char *data, size_t data_size)
Load a set of camera/lenses from a memory array.
void AddLens(lfLens *lens)
Add a lens to the database.
lfError Load()
Find and load the lens database.
const lfCamera *const * GetCameras() const
Retrieve a full list of cameras.
Struct to save image crop, which can depend on the focal length.
Definition: lensfun.h:660
Lens distortion calibration data.
Definition: lensfun.h:508
float Focal
Focal length in mm at which this calibration data was taken.
Definition: lensfun.h:512
Struct to save calibrated field of view, which can depends on the focal length (DEPRECATED)
Definition: lensfun.h:686
float FieldOfView
Field of view for given images.
Definition: lensfun.h:698
float Focal
Definition: lensfun.h:688
Struct to save real focal length, which can depends on the (nominal) focal length.
Definition: lensfun.h:708
float RealFocal
Real focal length.
Definition: lensfun.h:722
float Focal
Definition: lensfun.h:710
Laterlal chromatic aberrations calibration data.
Definition: lensfun.h:573
float Focal
Focal length in mm at which this calibration data was taken.
Definition: lensfun.h:577
Lens vignetting calibration data.
Definition: lensfun.h:626
float Distance
Focus distance in meters.
Definition: lensfun.h:634
float Aperture
Aperture (f-number) at which this calibration data was taken.
Definition: lensfun.h:632
float Focal
Focal length in mm at which this calibration data was taken.
Definition: lensfun.h:630
Lens data. Unknown fields are set to NULL or 0.
Definition: lensfun.h:802
char ** Mounts
Definition: lensfun.h:816
bool RemoveCalibCrop(int idx)
Remove a lens crop entry from the lens crop structure.
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 ...
lfLensCalibTCA ** CalibTCA
Definition: lensfun.h:838
lfMLstr Model
Definition: lensfun.h:806
DEPRECATED bool RemoveCalibFov(int idx)
Remove a field of view entry from the lens fov structure.
void GuessParameters()
This method fills some fields if they are missing but can be derived from other fields.
bool Check()
Check if a lens object is valid.
lfLensCalibFov ** CalibFov
Definition: lensfun.h:844
bool InterpolateRealFocal(float focal, lfLensCalibRealFocal &res) const
Interpolate lens real focal length data for given focal length.
void AddMount(const char *val)
Add a new mount type to this lens.
int Score
Definition: lensfun.h:848
lfMLstr Maker
Definition: lensfun.h:804
bool InterpolateDistortion(float focal, lfLensCalibDistortion &res) const
Interpolate lens geometry distortion data for given focal length.
float CropFactor
Definition: lensfun.h:830
float CenterY
Definition: lensfun.h:828
lfLens(const lfLens &other)
lfLensCalibRealFocal ** CalibRealFocal
Definition: lensfun.h:846
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 *dc)
Add a new distortion calibration structure to the pool.
bool RemoveCalibVignetting(int idx)
Remove a calibration entry from the vignetting calibration data.
DEPRECATED void AddCalibFov(const lfLensCalibFov *cf)
Add a new lens fov structure to the pool.
void SetModel(const char *val, const char *lang=NULL)
Add a string to camera model.
void SetMaker(const char *val, const char *lang=NULL)
Add a string to camera maker.
void AddCalibVignetting(const lfLensCalibVignetting *vc)
Add a new vignetting calibration structure to the pool.
float MinFocal
Definition: lensfun.h:808
bool InterpolateCrop(float focal, lfLensCalibCrop &res) const
Interpolate lens crop data for given focal length.
lfLens()
Create a new lens object, initializing all fields to default values.
float MaxFocal
Definition: lensfun.h:810
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.
lfLensCalibCrop ** CalibCrop
Definition: lensfun.h:842
float MinAperture
Definition: lensfun.h:812
void AddCalibCrop(const lfLensCalibCrop *cc)
Add a new lens crop structure to the pool.
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 ...
lfLensCalibDistortion ** CalibDistortion
Definition: lensfun.h:836
float AspectRatio
Definition: lensfun.h:832
void AddCalibTCA(const lfLensCalibTCA *tcac)
Add a new transversal chromatic aberration calibration structure to the pool.
bool InterpolateTCA(float focal, lfLensCalibTCA &res) const
Interpolate lens TCA calibration data for given focal length.
float MaxAperture
Definition: lensfun.h:814
float CenterX
Definition: lensfun.h:826
lfLensCalibVignetting ** CalibVignetting
Definition: lensfun.h:840
bool RemoveCalibTCA(int idx)
Remove a calibration entry from the TCA calibration data.
~lfLens()
Destroy this and all associated objects.
DEPRECATED bool InterpolateFov(float focal, lfLensCalibFov &res) const
Interpolate lens fov data for given focal length.
lfLensType Type
Definition: lensfun.h:834
bool RemoveCalibRealFocal(int idx)
Remove a real focal length entry from the lens real focal length structure.
void AddCalibRealFocal(const lfLensCalibRealFocal *cf)
Add a new lens real focal length structure to the pool.
static const char * GetLensTypeDesc(lfLensType type, const char **details)
Get the human-readable lens type name and a short description of this lens type.
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...
bool RemoveCalibDistortion(int idx)
Remove a calibration entry from the distortion calibration data.
A modifier object contains optimized data required to rectify a image.
Definition: lensfun.h:2016
static DEPRECATED lfModifier * Create(const lfLens *lens, float crop, int width, int height)
Create an empty image modifier object.
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.
bool AddCoordCallbackScale(float scale, bool reverse=false)
Add the stock image scaling callback into the chain.
lfModifier(const lfLens *lens, float crop, int width, int height)
Create an empty image modifier object.
void AddColorCallback(lfModifyColorFunc callback, int priority, void *data, size_t data_size)
Add a user-defined callback to the color modification chain.
bool AddCoordCallbackGeometry(lfLensType from, lfLensType to, float focal)
Add the stock lens geometry rectification callback into the chain.
void AddSubpixelCallback(lfSubpixelCoordFunc callback, int priority, void *data, size_t data_size)
Add a user-defined callback to the subpixel coordinate rectification chain.
bool ApplySubpixelGeometryDistortion(float xu, float yu, int width, int height, float *res) const
Apply stage 2 & 3 in one step.
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.
bool AddCoordCallbackDistortion(lfLensCalibDistortion &model, bool reverse=false)
Add the stock lens distortion correcting callback into the chain.
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.
DEPRECATED void Destroy()
Destroy the modifier object.
bool ApplySubpixelDistortion(float xu, float yu, int width, int height, float *res) const
Image correction step 3: apply subpixel distortions.
bool AddSubpixelCallbackTCA(lfLensCalibTCA &model, bool reverse=false)
Add the stock TCA correcting callback into the chain.
bool AddColorCallbackVignetting(lfLensCalibVignetting &model, lfPixelFormat format, bool reverse=false)
Add the stock lens vignetting correcting callback into the chain. The vignetting correction callback ...
void AddCoordCallback(lfModifyCoordFunc callback, int priority, void *data, size_t data_size)
Add a user-defined callback to the coordinate correction chain.
float GetAutoScale(bool reverse)
Compute the automatic scale factor for the image.
This structure contains everything specific to a camera mount.
Definition: lensfun.h:204
void AddCompat(const char *val)
Add a mount name to the list of compatible mounts.
bool Check()
Check if a mount object is valid.
lfMount()
Initialize a new mount object. All fields are set to 0.
lfMount(const lfMount &other)
lfMLstr Name
Camera mount name.
Definition: lensfun.h:210
void SetName(const char *val, const char *lang=NULL)
Add a string to mount name.
char ** Compat
Definition: lensfun.h:212
~lfMount()
Destroy a mount object. All allocated fields are freed.
This structure describes a single parameter for some lens model.
Definition: lensfun.h:731
const char * Name
Parameter name (something like 'k', 'k3', 'omega' etc.)
Definition: lensfun.h:733
float Max
Maximal value that has sense.
Definition: lensfun.h:737
float Min
Minimal value that has sense.
Definition: lensfun.h:735
float Default
Default value for the parameter.
Definition: lensfun.h:739