lensfun: lensfun.h Source File

lensfun 0.3.95.0

lensfun.h
Go to the documentation of this file.
1/* -*- mode:c++ -*- */
2/*
3 Lensfun - a library for maintaining a database of photographical lenses,
4 and providing the means to correct some of the typical lens distortions.
5 Copyright (C) 2007 by Andrew Zabolotny
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
16
17 You should have received a copy of the GNU Library General Public
18 License along with this library; if not, write to the Free
19 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20*/
21
22#ifndef __LENSFUN_H__
23#define __LENSFUN_H__
24
25#include <stddef.h>
26
27#ifndef __cplusplus
28 #if (defined(_MSC_VER) && (_MSC_VER < 1800)) // Visual studio up to VS2013 does not have stdbool.h
29 typedef int bool;
30 #define true 1
31 #define false 0
32 #else
33 #include <stdbool.h>
34 #endif
35#endif
36
37#ifdef __cplusplus
38
39#include <string>
40#include <vector>
41#include <set>
42
43extern "C" {
45# define C_TYPEDEF(t,c)
46#else
47# define C_TYPEDEF(t,c) typedef t c c;
48#endif
49
55/*----------------------------------------------------------------------------*/
56
64#define LF_VERSION_MAJOR 0
66#define LF_VERSION_MINOR 3
68#define LF_VERSION_MICRO 95
70#define LF_VERSION_BUGFIX 0
72#define LF_VERSION ((LF_VERSION_MAJOR << 24) | (LF_VERSION_MINOR << 16) | (LF_VERSION_MICRO << 8) | LF_VERSION_BUGFIX)
73
75#define LF_MIN_DATABASE_VERSION 0
77#define LF_MAX_DATABASE_VERSION 2
78
79#if defined CONF_LENSFUN_STATIC
81# define LF_EXPORT
82#else
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")))
88# else
89# error "I don't know how to change symbol visibility for your compiler"
90# endif
91# else
92# if defined PLATFORM_WINDOWS || defined _MSC_VER
93# define LF_EXPORT __declspec(dllimport)
94# else
95# define LF_EXPORT
96# endif
97# endif
98#endif
99
100#ifndef CONF_LENSFUN_INTERNAL
102# ifdef __GNUC__
103# define DEPRECATED __attribute__((deprecated))
104# elif defined(_MSC_VER)
105# define DEPRECATED __declspec(deprecated)
106# else
107# pragma message("WARNING: You need to implement DEPRECATED for this compiler")
108# define DEPRECATED
109# endif
110#else
111# define DEPRECATED
112#endif
113
115#define cbool int
116
125 typedef char *lfMLstr;
126
128 enum lfError
129{
131 LF_NO_ERROR = 0,
133 LF_WRONG_FORMAT,
135 LF_NO_DATABASE
136};
137
138 C_TYPEDEF (enum, lfError)
139
140
141typedef unsigned char lf_u8;
143typedef unsigned short lf_u16;
145typedef unsigned int lf_u32;
147typedef float lf_f32;
149typedef double lf_f64;
150
159 LF_EXPORT void lf_free (void *data);
160
169 LF_EXPORT const char *lf_mlstr_get (const lfMLstr str);
170
187 LF_EXPORT lfMLstr lf_mlstr_add (lfMLstr str, const char *lang, const char *trstr);
188
197 LF_EXPORT lfMLstr lf_mlstr_dup (const lfMLstr str);
198
201/*----------------------------------------------------------------------------*/
202
218struct LF_EXPORT lfMount
219{
225 lfMLstr Name;
227 DEPRECATED char **Compat;
228
229#ifdef __cplusplus
233 lfMount ();
234
238 lfMount (const lfMount &other);
239
243 lfMount &operator = (const lfMount &other);
244
248 bool operator == (const lfMount& other);
249
253 ~lfMount ();
254
265 void SetName (const char *val, const char *lang = NULL);
266
272 void AddCompat (const char *val);
273
277 const char* const* GetCompats () const;
278
284 bool Check ();
285
286private:
287 std::vector<char*> MountCompat;
288#endif
289};
290
291 C_TYPEDEF (struct, lfMount)
292
293
302 DEPRECATED LF_EXPORT lfMount *lf_mount_new ();
303
311 LF_EXPORT lfMount *lf_mount_create();
312
322 LF_EXPORT void lf_mount_destroy (lfMount *mount);
323
333 LF_EXPORT void lf_mount_copy (lfMount *dest, const lfMount *source);
334
336 LF_EXPORT cbool lf_mount_check (lfMount *mount);
337
339 LF_EXPORT void lf_mount_add_compat (lfMount *mount, const char *val);
340
342 LF_EXPORT const char* const* lf_mount_get_compats (lfMount *mount);
343
346/*----------------------------------------------------------------------------*/
347
365struct LF_EXPORT lfCamera
366{
368 lfMLstr Maker;
370 lfMLstr Model;
372 lfMLstr Variant;
374 char *Mount;
376 float CropFactor;
378 int Score;
379
380#ifdef __cplusplus
384 lfCamera ();
385
389 lfCamera (const lfCamera &other);
390
394 ~lfCamera ();
395
399 lfCamera &operator = (const lfCamera &other);
400
411 void SetMaker (const char *val, const char *lang = NULL);
412
423 void SetModel (const char *val, const char *lang = NULL);
424
435 void SetVariant (const char *val, const char *lang = NULL);
436
442 void SetMount (const char *val);
443
449 bool Check ();
450#endif
451};
452
453 C_TYPEDEF (struct, lfCamera)
454
455
464 DEPRECATED LF_EXPORT lfCamera *lf_camera_new ();
465
474 LF_EXPORT lfCamera *lf_camera_create ();
475
485 LF_EXPORT void lf_camera_destroy (lfCamera *camera);
486
496 LF_EXPORT void lf_camera_copy (lfCamera *dest, const lfCamera *source);
497
499 LF_EXPORT cbool lf_camera_check (lfCamera *camera);
500
503/*----------------------------------------------------------------------------*/
504
518struct lfLensCalibAttributes
519{
529 float CenterX;
531 float CenterY;
533 float CropFactor;
535 float AspectRatio;
536
537 #ifdef __cplusplus
538 bool operator==(const lfLensCalibAttributes& other)
539 {
540 return CenterX == other.CenterX &&
541 CenterY == other.CenterY &&
542 CropFactor == other.CropFactor &&
543 AspectRatio == other.AspectRatio;
544 }
545 #endif
546};
547
548 C_TYPEDEF (struct, lfLensCalibAttributes)
549
550
563enum lfDistortionModel
564{
566 LF_DIST_MODEL_NONE,
574 LF_DIST_MODEL_POLY3,
583 LF_DIST_MODEL_POLY5,
591 LF_DIST_MODEL_PTLENS,
608 LF_DIST_MODEL_ACM,
609};
610
611 C_TYPEDEF (enum, lfDistortionModel)
612
613
619struct lfLensCalibDistortion
620{
622 enum lfDistortionModel Model;
625 float Focal;
655 float RealFocal;
658 cbool RealFocalMeasured;
660 float Terms [5];
662 lfLensCalibAttributes CalibAttr;
663};
664
665 C_TYPEDEF (struct, lfLensCalibDistortion)
666
667
680enum lfTCAModel
681{
683 LF_TCA_MODEL_NONE,
695 LF_TCA_MODEL_LINEAR,
707 LF_TCA_MODEL_POLY3,
735 LF_TCA_MODEL_ACM
736};
737
738 C_TYPEDEF (enum, lfTCAModel)
739
740
747struct lfLensCalibTCA
748{
750 enum lfTCAModel Model;
752 float Focal;
754 float Terms [12];
756 lfLensCalibAttributes CalibAttr;
757};
758
759 C_TYPEDEF (struct, lfLensCalibTCA)
760
761
777enum lfVignettingModel
778{
780 LF_VIGNETTING_MODEL_NONE,
790 LF_VIGNETTING_MODEL_PA,
801 LF_VIGNETTING_MODEL_ACM
802};
803
804 C_TYPEDEF (enum, lfVignettingModel)
805
806
813struct lfLensCalibVignetting
814{
816 enum lfVignettingModel Model;
818 float Focal;
820 float Aperture;
822 float Distance;
824 float Terms [3];
826 lfLensCalibAttributes CalibAttr;
827};
828
829 C_TYPEDEF (struct, lfLensCalibVignetting)
830
831
834enum lfCropMode
835{
837 LF_NO_CROP,
839 LF_CROP_RECTANGLE,
841 LF_CROP_CIRCLE
842};
843
844 C_TYPEDEF(enum, lfCropMode)
845
846
849struct lfLensCalibCrop
850{
852 float Focal;
854 enum lfCropMode CropMode;
863 float Crop [4];
865 lfLensCalibAttributes CalibAttr;
866};
867
868 C_TYPEDEF (struct, lfLensCalibCrop)
869
870
877struct lfLensCalibFov
878{
880 float Focal;
890 float FieldOfView;
892 lfLensCalibAttributes CalibAttr;
893};
894
895 C_TYPEDEF (struct, lfLensCalibFov)
896
897
904struct lfLensCalibrationSet
905{
907 lfLensCalibAttributes Attributes;
908
909#ifdef __cplusplus
910 lfLensCalibrationSet(lfLensCalibAttributes attributes) : Attributes(attributes) {}
911
912 lfLensCalibrationSet(const lfLensCalibrationSet &other)
913 {
914 Attributes = other.Attributes;
915 for (auto *cb : other.CalibDistortion)
916 CalibDistortion.push_back(new lfLensCalibDistortion(*cb));
917 for (auto *cb : other.CalibVignetting)
918 CalibVignetting.push_back(new lfLensCalibVignetting(*cb));
919 for (auto *cb : other.CalibTCA)
920 CalibTCA.push_back(new lfLensCalibTCA(*cb));
921 for (auto *cb : other.CalibCrop)
922 CalibCrop.push_back(new lfLensCalibCrop(*cb));
923 for (auto *cb : other.CalibFov)
924 CalibFov.push_back(new lfLensCalibFov(*cb));
925 }
926
927 ~lfLensCalibrationSet()
928 {
929 for (auto cb : CalibDistortion)
930 delete cb;
931 for (auto cb : CalibVignetting)
932 delete cb;
933 for (auto cb : CalibTCA)
934 delete cb;
935 for (auto cb : CalibCrop)
936 delete cb;
937 for (auto cb : CalibFov)
938 delete cb;
939 }
940
941 bool Empty() const
942 {
943 return CalibDistortion.empty() && CalibTCA.empty() && CalibVignetting.empty() &&
944 CalibCrop.empty() && CalibFov.empty();
945 }
946
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(); }
952
953 private:
954
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;
965
966 friend class lfDatabase;
967 friend class lfLens;
968#endif
969};
970
971
975 struct lfParameter
976{
978 const char *Name;
980 float Min;
982 float Max;
984 float Default;
985};
986
987 C_TYPEDEF (struct, lfParameter)
988
989
992enum lfLensType
993{
995 LF_UNKNOWN,
1000 LF_RECTILINEAR,
1006 LF_FISHEYE,
1013 LF_PANORAMIC,
1020 LF_EQUIRECTANGULAR,
1022 LF_FISHEYE_ORTHOGRAPHIC,
1024 LF_FISHEYE_STEREOGRAPHIC,
1026 LF_FISHEYE_EQUISOLID,
1032 LF_FISHEYE_THOBY
1033};
1034
1035 C_TYPEDEF (enum, lfLensType)
1036
1037
1046struct LF_EXPORT lfLens
1047{
1049 lfMLstr Maker;
1051 lfMLstr Model;
1053 float MinFocal;
1055 float MaxFocal;
1057 float MinAperture;
1059 float MaxAperture;
1061 DEPRECATED char **Mounts;
1063 lfLensType Type;
1073 DEPRECATED float CenterX;
1075 DEPRECATED float CenterY;
1077 DEPRECATED float CropFactor;
1079 DEPRECATED float AspectRatio;
1081 DEPRECATED lfLensCalibDistortion **CalibDistortion;
1083 DEPRECATED lfLensCalibTCA **CalibTCA;
1085 DEPRECATED lfLensCalibVignetting **CalibVignetting;
1087 DEPRECATED lfLensCalibCrop **CalibCrop;
1089 DEPRECATED lfLensCalibFov **CalibFov;
1091 int Score;
1092
1093#ifdef __cplusplus
1094
1098 lfLens ();
1099
1103 lfLens (const lfLens &other);
1104
1108 ~lfLens ();
1109
1113 lfLens &operator = (const lfLens &other);
1114
1125 void SetMaker (const char *val, const char *lang = NULL);
1126
1137 void SetModel (const char *val, const char *lang = NULL);
1138
1146 void AddMount (const char *val);
1147
1158 void AddCalibDistortion (const lfLensCalibDistortion *lcd);
1159
1165 DEPRECATED bool RemoveCalibDistortion (int idx);
1166
1178 void AddCalibTCA (const lfLensCalibTCA *lctca);
1179
1185 DEPRECATED bool RemoveCalibTCA (int idx);
1186
1197 void AddCalibVignetting (const lfLensCalibVignetting *lcv);
1198
1204 DEPRECATED bool RemoveCalibVignetting (int idx);
1205
1216 void AddCalibCrop (const lfLensCalibCrop *lcc);
1217
1223 DEPRECATED bool RemoveCalibCrop (int idx);
1224
1238 DEPRECATED void AddCalibFov (const lfLensCalibFov *lcf);
1239
1249 DEPRECATED bool RemoveCalibFov (int idx);
1250
1255 void RemoveCalibrations();
1256
1265 void GuessParameters ();
1266
1272 bool Check ();
1273
1289 static const char *GetDistortionModelDesc (
1290 lfDistortionModel model, const char **details, const lfParameter ***params);
1306 static const char *GetTCAModelDesc (
1307 lfTCAModel model, const char **details, const lfParameter ***params);
1308
1324 static const char *GetVignettingModelDesc (
1325 lfVignettingModel model, const char **details, const lfParameter ***params);
1326
1342 static const char *GetCropDesc (
1343 lfCropMode mode, const char **details, const lfParameter ***params);
1344
1356 static const char *GetLensTypeDesc (lfLensType type, const char **details);
1357
1368 DEPRECATED bool InterpolateDistortion (float focal, lfLensCalibDistortion &res) const;
1369
1383 bool InterpolateDistortion (float crop, float focal, lfLensCalibDistortion &res) const;
1384
1395 DEPRECATED bool InterpolateTCA (float focal, lfLensCalibTCA &res) const;
1396
1409 bool InterpolateTCA (float crop, float focal, lfLensCalibTCA &res) const;
1410
1427 DEPRECATED bool InterpolateVignetting (
1428 float focal, float aperture, float distance, lfLensCalibVignetting &res) const;
1429
1448 bool InterpolateVignetting (
1449 float crop, float focal, float aperture, float distance, lfLensCalibVignetting &res) const;
1450
1461 DEPRECATED bool InterpolateCrop (float focal, lfLensCalibCrop &res) const;
1462
1475 bool InterpolateCrop (float crop, float focal, lfLensCalibCrop &res) const;
1476
1490 DEPRECATED bool InterpolateFov (float focal, lfLensCalibFov &res) const;
1491
1507 DEPRECATED bool InterpolateFov (float crop, float focal, lfLensCalibFov &res) const;
1508
1509
1516 const lfLensCalibrationSet* const* GetCalibrationSets() const;
1517
1524 const char* const* GetMountNames() const;
1525
1526 private:
1527 void UpdateLegacyCalibPointers();
1528
1529 std::vector<lfLensCalibrationSet*> Calibrations;
1530 std::vector<char*> MountNames;
1531
1532 lfLensCalibrationSet* GetClosestCalibrationSet(const float crop) const;
1533 lfLensCalibrationSet* GetCalibrationSetForAttributes(const lfLensCalibAttributes lcattr);
1534
1535 friend class lfDatabase;
1536#endif
1537};
1538
1539 C_TYPEDEF (struct, lfLens)
1540
1541
1550 DEPRECATED LF_EXPORT lfLens *lf_lens_new ();
1551
1560 LF_EXPORT lfLens *lf_lens_create ();
1561
1571 LF_EXPORT void lf_lens_destroy (lfLens *lens);
1572
1582 LF_EXPORT void lf_lens_copy (lfLens *dest, const lfLens *source);
1583
1585 LF_EXPORT cbool lf_lens_check (lfLens *lens);
1586
1588 LF_EXPORT void lf_lens_guess_parameters (lfLens *lens);
1589
1591 LF_EXPORT void lf_lens_add_mount (lfLens *lens, const char *val);
1592
1594 LF_EXPORT const char* const* lf_lens_get_mount_names (lfLens *lens);
1595
1597 LF_EXPORT const char *lf_get_distortion_model_desc (
1598 enum lfDistortionModel model, const char **details, const lfParameter ***params);
1599
1601 LF_EXPORT const char *lf_get_tca_model_desc (
1602 enum lfTCAModel model, const char **details, const lfParameter ***params);
1603
1605 LF_EXPORT const char *lf_get_vignetting_model_desc (
1606 enum lfVignettingModel model, const char **details, const lfParameter ***params);
1607
1609 LF_EXPORT const char *lf_get_crop_desc (
1610 enum lfCropMode mode, const char **details, const lfParameter ***params);
1611
1613 LF_EXPORT const char *lf_get_lens_type_desc (
1614 enum lfLensType type, const char **details);
1615
1617 LF_EXPORT cbool lf_lens_interpolate_distortion (const lfLens *lens, float crop, float focal,
1618 lfLensCalibDistortion *res);
1619
1621 LF_EXPORT cbool lf_lens_interpolate_tca (const lfLens *lens, float crop, float focal, lfLensCalibTCA *res);
1622
1624 LF_EXPORT cbool lf_lens_interpolate_vignetting (const lfLens *lens, float crop, float focal, float aperture,
1625 float distance, lfLensCalibVignetting *res);
1626
1628 LF_EXPORT cbool lf_lens_interpolate_crop (const lfLens *lens, float crop, float focal,
1629 lfLensCalibCrop *res);
1630
1632 DEPRECATED LF_EXPORT cbool lf_lens_interpolate_fov (const lfLens *lens, float crop, float focal,
1633 lfLensCalibFov *res);
1634
1636 LF_EXPORT void lf_lens_add_calib_distortion (lfLens *lens, const lfLensCalibDistortion *dc);
1637
1639 LF_EXPORT cbool lf_lens_remove_calib_distortion (lfLens *lens, int idx);
1640
1642 LF_EXPORT void lf_lens_add_calib_tca (lfLens *lens, const lfLensCalibTCA *tcac);
1643
1645 LF_EXPORT cbool lf_lens_remove_calib_tca (lfLens *lens, int idx);
1646
1648 LF_EXPORT void lf_lens_add_calib_vignetting (lfLens *lens, const lfLensCalibVignetting *vc);
1649
1651 LF_EXPORT cbool lf_lens_remove_calib_vignetting (lfLens *lens, int idx);
1652
1654 LF_EXPORT void lf_lens_add_calib_crop (lfLens *lens, const lfLensCalibCrop *cc);
1655
1657 LF_EXPORT cbool lf_lens_remove_calib_crop (lfLens *lens, int idx);
1658
1660 DEPRECATED LF_EXPORT void lf_lens_add_calib_fov (lfLens *lens, const lfLensCalibFov *cf);
1661
1663 DEPRECATED LF_EXPORT cbool lf_lens_remove_calib_fov (lfLens *lens, int idx);
1664
1666 LF_EXPORT void lf_lens_remove_calibrations (lfLens *lens);
1667
1670/*----------------------------------------------------------------------------*/
1671
1681enum
1682{
1690 LF_SEARCH_LOOSE = 1,
1702 LF_SEARCH_SORT_AND_UNIQUIFY = 2
1703};
1704
1718 struct LF_EXPORT lfDatabase
1719{
1721 DEPRECATED char *HomeDataDir;
1723 DEPRECATED char *UserUpdatesDir;
1724
1725#ifdef __cplusplus
1726
1728 static const char *const UserLocation;
1731 static const char *const UserUpdatesLocation;
1733 static const char *const SystemLocation;
1736 static const char *const SystemUpdatesLocation;
1737
1739 lfDatabase ();
1741 ~lfDatabase ();
1742
1749 DEPRECATED static lfDatabase *Create ();
1750
1757 DEPRECATED void Destroy ();
1758
1772 static long int ReadTimestamp (const char *dirname);
1773
1788 DEPRECATED bool LoadDirectory (const char *dirname);
1789
1798 lfError Load ();
1799
1813 lfError Load (const char *pathname);
1814
1825 lfError Load (const char *data, size_t data_size);
1826
1834 lfError Save (const char *filename) const;
1835
1842 char *Save () const;
1843
1868 const lfCamera **FindCameras (const char *maker, const char *model) const;
1869
1890 const lfCamera **FindCamerasExt (const char *maker, const char *model,
1891 int sflags = 0) const;
1892
1900 const lfCamera *const *GetCameras ();
1901
1939 const lfLens **FindLenses (const lfCamera *camera, const char *maker,
1940 const char *model, int sflags = 0) const;
1941
1949 const lfLens *const *GetLenses ();
1950
1958 const lfMount *FindMount (const char *mount) const;
1959
1967 const char *MountName (const char *mount) const;
1968
1976 const lfMount *const *GetMounts ();
1977
1986 void AddMount (lfMount *mount);
1987
1996 void AddCamera (lfCamera *camera);
1997
2006 void AddLens (lfLens *lens);
2007
2008private:
2009
2036 int MatchScore (const lfLens *pattern, const lfLens *match, const lfCamera *camera,
2037 void *fuzzycmp, const char* const* compat_mounts) const;
2038
2039 lfError Load (const char *errcontext, const char *data, size_t data_size);
2040
2041 std::vector<lfMount*> Mounts;
2042 std::vector<lfCamera*> Cameras;
2043 std::vector<lfLens*> Lenses;
2044#endif
2045};
2046
2047 C_TYPEDEF (struct, lfDatabase)
2048
2049
2050extern const char* const lf_db_system_location;
2052extern const char* const lf_db_system_updates_location;
2054extern const char* const lf_db_user_location;
2056extern const char* const lf_db_user_updates_location;
2057
2067 DEPRECATED LF_EXPORT lfDatabase *lf_db_new (void);
2068
2079 LF_EXPORT lfDatabase *lf_db_create (void);
2080
2090 LF_EXPORT void lf_db_destroy (lfDatabase *db);
2091
2093 LF_EXPORT long int lf_db_read_timestamp (lfDatabase *db, const char *dirname);
2094
2096 LF_EXPORT lfError lf_db_load (lfDatabase *db);
2097
2099 DEPRECATED LF_EXPORT lfError lf_db_load_file (lfDatabase *db, const char *filename);
2100
2102 DEPRECATED LF_EXPORT cbool lf_db_load_directory (lfDatabase *db, const char *dirname);
2103
2105 LF_EXPORT lfError lf_db_load_path (lfDatabase *db, const char *pathname);
2106
2108 LF_EXPORT lfError lf_db_load_data (lfDatabase *db, const char *errcontext,
2109 const char *data, size_t data_size);
2110
2112 LF_EXPORT lfError lf_db_save_all (const lfDatabase *db, const char *filename);
2113
2115 LF_EXPORT lfError lf_db_save_file (const lfDatabase *db, const char *filename,
2116 const lfMount *const *mounts,
2117 const lfCamera *const *cameras,
2118 const lfLens *const *lenses);
2119
2121 LF_EXPORT char *lf_db_save (const lfMount *const *mounts,
2122 const lfCamera *const *cameras,
2123 const lfLens *const *lenses);
2124
2126 LF_EXPORT const lfCamera **lf_db_find_cameras (
2127 const lfDatabase *db, const char *maker, const char *model);
2128
2130 LF_EXPORT const lfCamera **lf_db_find_cameras_ext (
2131 const lfDatabase *db, const char *maker, const char *model, int sflags);
2132
2134 LF_EXPORT const lfCamera *const *lf_db_get_cameras (lfDatabase *db);
2135
2137 DEPRECATED LF_EXPORT const lfLens **lf_db_find_lenses_hd (
2138 const lfDatabase *db, const lfCamera *camera, const char *maker,
2139 const char *lens, int sflags);
2140
2142 LF_EXPORT const lfLens **lf_db_find_lenses (
2143 const lfDatabase *db, const lfCamera *camera,
2144 const char *maker, const char *lens, int sflags);
2145
2147 LF_EXPORT const lfLens *const *lf_db_get_lenses (lfDatabase *db);
2148
2150 LF_EXPORT const lfMount *lf_db_find_mount (const lfDatabase *db, const char *mount);
2151
2153 LF_EXPORT const char *lf_db_mount_name (const lfDatabase *db, const char *mount);
2154
2156 LF_EXPORT const lfMount *const *lf_db_get_mounts (lfDatabase *db);
2157
2160/*----------------------------------------------------------------------------*/
2161
2170enum
2171{
2173 LF_MODIFY_TCA = 0x00000001,
2175 LF_MODIFY_VIGNETTING = 0x00000002,
2176 /* Value 0x00000004 is deprecated. */
2178 LF_MODIFY_DISTORTION = 0x00000008,
2180 LF_MODIFY_GEOMETRY = 0x00000010,
2182 LF_MODIFY_SCALE = 0x00000020,
2184 LF_MODIFY_PERSPECTIVE = 0x00000040,
2186 LF_MODIFY_ALL = ~0
2187};
2188
2190 enum lfPixelFormat
2191{
2193 LF_PF_U8,
2195 LF_PF_U16,
2197 LF_PF_U32,
2199 LF_PF_F32,
2201 LF_PF_F64
2202};
2203
2204 C_TYPEDEF (enum, lfPixelFormat)
2205
2206
2209enum lfComponentRole
2210{
2215 LF_CR_END = 0,
2222 LF_CR_NEXT,
2224 LF_CR_UNKNOWN,
2226 LF_CR_INTENSITY,
2228 LF_CR_RED,
2230 LF_CR_GREEN,
2232 LF_CR_BLUE
2233};
2234
2235 C_TYPEDEF (enum, lfComponentRole)
2236
2237
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))
2265
2266// @cond
2267
2268
2269
2270// @endcond
2271
2346#ifdef __cplusplus
2347}
2348#endif
2349
2350 struct LF_EXPORT lfModifier
2351{
2352#ifdef __cplusplus
2374 DEPRECATED lfModifier (const lfLens *lens, float crop, int width, int height);
2375
2402 DEPRECATED static lfModifier *Create (const lfLens *lens, float crop, int width, int height);
2403
2449 DEPRECATED int Initialize (
2450 const lfLens *lens, lfPixelFormat format, float focal, float aperture,
2451 float distance, float scale, lfLensType targeom, int flags, bool reverse);
2452
2459 DEPRECATED void Destroy ();
2460
2485 lfModifier (float imgcrop, int imgwidth, int imgheight, lfPixelFormat pixel_format, bool reverse = false);
2486
2488 ~lfModifier ();
2489
2498 int EnableDistortionCorrection (const lfLensCalibDistortion& lcd);
2509 int EnableDistortionCorrection (const lfLens* lens, float focal);
2510
2519 int EnableTCACorrection (const lfLensCalibTCA& lctca);
2530 int EnableTCACorrection (const lfLens* lens, float focal);
2531
2540 int EnableVignettingCorrection (const lfLensCalibVignetting& lcv);
2555 int EnableVignettingCorrection (const lfLens* lens, float focal, float aperture, float distance);
2556
2569 int EnableProjectionTransform (const lfLens* lens, float focal, lfLensType target_projection);
2570 //bool EnableProjectionTransform (float focal, lfLensType target_projection);
2571
2580 int EnableScaling (float scale);
2581
2582
2637 int EnablePerspectiveCorrection (const lfLens* lens, float focal, float *x, float *y, int count, float d);
2638
2652 float GetAutoScale (bool reverse);
2653
2683 bool ApplyColorModification (void *pixels, float x, float y, int width, int height,
2684 int comp_role, int row_stride) const;
2685
2716 bool ApplyGeometryDistortion (float xu, float yu, int width, int height,
2717 float *res) const;
2718
2750 bool ApplySubpixelDistortion (float xu, float yu, int width, int height,
2751 float *res) const;
2752
2783 bool ApplySubpixelGeometryDistortion (float xu, float yu, int width, int height,
2784 float *res) const;
2785
2786private:
2787
2789 struct lfCallbackData
2790 {
2791 virtual ~lfCallbackData() {}
2792 int priority;
2793
2794 bool operator<(const lfCallbackData& c) const { return priority < c.priority; }
2795 bool operator>(const lfCallbackData& c) const { return priority > c.priority; }
2796 };
2797
2800 struct lfCallBackDataPtrComp
2801 {
2802 bool operator () (const lfCallbackData* lhs, const lfCallbackData* rhs) const {
2803 return lhs->priority < rhs->priority;
2804 }
2805 };
2806
2822 typedef void (*lfModifySubpixCoordFunc) (void *data, float *iocoord, int count);
2823
2848 typedef void (*lfModifyColorFunc) (void *data, float x, float y,
2849 void *pixels, int comp_role, int count);
2850
2863 typedef void (*lfModifyCoordFunc) (void *data, float *iocoord, int count);
2864
2866 struct lfSubpixelCallback : public lfCallbackData
2867 {
2868 lfModifySubpixCoordFunc callback;
2869 };
2870
2871 struct lfSubpixTCACallback : public lfSubpixelCallback
2872 {
2873 float coordinate_correction;
2874 float norm_focal;
2875 float centerX;
2876 float centerY;
2877 float Terms [12];
2878 };
2879
2881 struct lfCoordCallback : public lfCallbackData
2882 {
2883 lfModifyCoordFunc callback;
2884 };
2885
2886 struct lfCoordDistCallbackData : public lfCoordCallback
2887 {
2888 float coordinate_correction;
2889 float centerX;
2890 float centerY;
2891 float norm_focal;
2892 float Terms [5];
2893 };
2894
2895 struct lfCoordScaleCallbackData : public lfCoordCallback
2896 {
2897 float scale_factor;
2898 };
2899
2900 struct lfCoordGeomCallbackData : public lfCoordCallback
2901 {
2902 float norm_focal;
2903 };
2904
2905 struct lfCoordPerspCallbackData : public lfCoordCallback
2906 {
2907 float A [3][3];
2908 float delta_a, delta_b;
2909 };
2910
2912 struct lfColorCallback : public lfCallbackData
2913 {
2914 lfModifyColorFunc callback;
2915 };
2916
2917 struct lfColorVignCallbackData : public lfColorCallback
2918 {
2919 float coordinate_correction;
2920 float NormScale;
2921 float centerX;
2922 float centerY;
2923 float Terms [3];
2924 };
2925
2927 std::multiset<lfSubpixelCallback*, lfCallBackDataPtrComp> SubpixelCallbacks;
2929 std::multiset<lfColorCallback*, lfCallBackDataPtrComp> ColorCallbacks;
2931 std::multiset<lfCoordCallback*, lfCallBackDataPtrComp> CoordCallbacks;
2932
2933 // A test point in the autoscale algorithm
2934 typedef struct { float angle, dist; } lfPoint;
2935
2936 void AddSubpixTCACallback (const lfLensCalibTCA& lcd, lfModifySubpixCoordFunc func, int priority);
2937 void AddCoordGeomCallback (float norm_focal, lfModifyCoordFunc func, int priority);
2938 void AddCoordDistCallback (const lfLensCalibDistortion& lcd, lfModifyCoordFunc func, int priority);
2939 void AddColorVignCallback (const lfLensCalibVignetting& lcv, lfModifyColorFunc func, int priority);
2940
2954 double AutoscaleResidualDistance (float *coord) const;
2969 float GetTransformedDistance (lfPoint point) const;
2970
2985 float GetNormalizedFocalLength (float focal, const lfLens* lens) const;
2986
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);
2991
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);
2996#endif
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);
3004#endif
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);
3031#endif
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);
3035#endif
3036
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);
3041
3042 static void ModifyCoord_Scale (void *data, float *iocoord, int count);
3043#endif
3046 double Width, Height;
3048 double Crop;
3050 double CenterX, CenterY;
3052 double NormScale, NormUnScale;
3053
3055 cbool Reverse;
3056
3058 lfPixelFormat PixelFormat;
3059
3061 int enabledMods;
3062};
3063
3064#ifdef __cplusplus
3065extern "C" {
3066#endif
3067
3068 C_TYPEDEF (struct, lfModifier)
3069
3070
3071 DEPRECATED LF_EXPORT lfModifier *lf_modifier_new (
3072 const lfLens *lens, float crop, int width, int height);
3073
3075 LF_EXPORT lfModifier *lf_modifier_create (
3076 float imgcrop, int imgwidth, int imgheight, lfPixelFormat pixel_format, bool reverse);
3077
3079 LF_EXPORT void lf_modifier_destroy (lfModifier *modifier);
3080
3082 DEPRECATED LF_EXPORT int lf_modifier_initialize (
3083 lfModifier *modifier, const lfLens *lens, lfPixelFormat format,
3084 float focal, float aperture, float distance, float scale,
3085 lfLensType targeom, int flags, cbool reverse);
3086
3088 LF_EXPORT int lf_modifier_enable_scaling (lfModifier *modifier, float scale);
3089
3091 LF_EXPORT int lf_modifier_enable_distortion_correction (lfModifier *modifier, const lfLens* lens, float focal);
3092
3094 LF_EXPORT int lf_modifier_enable_tca_correction (lfModifier *modifier, const lfLens* lens, float focal);
3095
3097 LF_EXPORT int lf_modifier_enable_vignetting_correction (
3098 lfModifier *modifier, const lfLens* lens, float focal, float aperture, float distance);
3099
3101 LF_EXPORT cbool lf_modifier_enable_projection_transform (
3102 lfModifier *modifier, const lfLens* lens, float focal, lfLensType target_projection);
3103
3105 LF_EXPORT int lf_modifier_enable_perspective_correction (
3106 lfModifier *modifier, const lfLens* lens, float focal, float *x, float *y, int count, float d);
3107
3109 LF_EXPORT float lf_modifier_get_auto_scale (
3110 lfModifier *modifier, cbool reverse);
3111
3113 LF_EXPORT cbool lf_modifier_apply_subpixel_distortion (
3114 lfModifier *modifier, float xu, float yu, int width, int height, float *res);
3115
3117 LF_EXPORT cbool lf_modifier_apply_color_modification (
3118 lfModifier *modifier, void *pixels, float x, float y, int width, int height,
3119 int comp_role, int row_stride);
3120
3122 LF_EXPORT cbool lf_modifier_apply_geometry_distortion (
3123 lfModifier *modifier, float xu, float yu, int width, int height, float *res);
3124
3126 LF_EXPORT cbool lf_modifier_apply_subpixel_geometry_distortion (
3127 lfModifier *modifier, float xu, float yu, int width, int height, float *res);
3128
3131#undef cbool
3132
3133#ifdef __cplusplus
3134}
3135#endif
3136
3137#endif /* __LENSFUN_H__ */
lf_mlstr_dup
lfMLstr lf_mlstr_dup(const lfMLstr str)
Create a complete copy of a multi-language string.
lf_u8
unsigned char lf_u8
Definition: lensfun.h:141
lfMLstr
char * lfMLstr
Definition: lensfun.h:125
lf_free
void lf_free(void *data)
lf_mlstr_get
const char * lf_mlstr_get(const lfMLstr str)
Get a string corresponding to current locale from a multi-language string.
lf_u16
unsigned short lf_u16
Definition: lensfun.h:143
LF_EXPORT
#define LF_EXPORT
This macro expands to an appropiate symbol visibility declaration.
Definition: lensfun.h:81
lf_f64
double lf_f64
Definition: lensfun.h:149
DEPRECATED
#define DEPRECATED
For marking deprecated functions, see http://stackoverflow.com/a/21265197.
Definition: lensfun.h:108
lf_u32
unsigned int lf_u32
Definition: lensfun.h:145
lf_f32
float lf_f32
Definition: lensfun.h:147
cbool
#define cbool
C-compatible bool type; don't bother to define Yet Another Boolean Type.
Definition: lensfun.h:115
lf_mlstr_add
lfMLstr lf_mlstr_add(lfMLstr str, const char *lang, const char *trstr)
Add a new translated string to a multi-language string.
lfError
lfError
Definition: lensfun.h:129
LF_NO_ERROR
@ LF_NO_ERROR
Definition: lensfun.h:131
LF_NO_DATABASE
@ LF_NO_DATABASE
Definition: lensfun.h:135
LF_WRONG_FORMAT
@ LF_WRONG_FORMAT
Definition: lensfun.h:133
lf_camera_copy
void lf_camera_copy(lfCamera *dest, const lfCamera *source)
Copy the data from one lfCamera structure into another.
lf_camera_check
cbool lf_camera_check(lfCamera *camera)
lf_camera_create
lfCamera * lf_camera_create()
Create a new camera object.
lf_camera_new
DEPRECATED lfCamera * lf_camera_new()
Create a new camera object.
lf_camera_destroy
void lf_camera_destroy(lfCamera *camera)
Destroy a lfCamera object.
lf_modifier_apply_subpixel_distortion
cbool lf_modifier_apply_subpixel_distortion(lfModifier *modifier, float xu, float yu, int width, int height, float *res)
lf_modifier_enable_perspective_correction
int lf_modifier_enable_perspective_correction(lfModifier *modifier, const lfLens *lens, float focal, float *x, float *y, int count, float d)
lf_modifier_destroy
void lf_modifier_destroy(lfModifier *modifier)
lf_modifier_apply_color_modification
cbool lf_modifier_apply_color_modification(lfModifier *modifier, void *pixels, float x, float y, int width, int height, int comp_role, int row_stride)
lf_modifier_new
DEPRECATED lfModifier * lf_modifier_new(const lfLens *lens, float crop, int width, int height)
lf_modifier_enable_distortion_correction
int lf_modifier_enable_distortion_correction(lfModifier *modifier, const lfLens *lens, float focal)
lf_modifier_get_auto_scale
float lf_modifier_get_auto_scale(lfModifier *modifier, cbool reverse)
lf_modifier_enable_projection_transform
cbool lf_modifier_enable_projection_transform(lfModifier *modifier, const lfLens *lens, float focal, lfLensType target_projection)
lf_modifier_enable_vignetting_correction
int lf_modifier_enable_vignetting_correction(lfModifier *modifier, const lfLens *lens, float focal, float aperture, float distance)
lf_modifier_apply_geometry_distortion
cbool lf_modifier_apply_geometry_distortion(lfModifier *modifier, float xu, float yu, int width, int height, float *res)
lf_modifier_create
lfModifier * lf_modifier_create(float imgcrop, int imgwidth, int imgheight, lfPixelFormat pixel_format, bool reverse)
lf_modifier_apply_subpixel_geometry_distortion
cbool lf_modifier_apply_subpixel_geometry_distortion(lfModifier *modifier, float xu, float yu, int width, int height, float *res)
lf_modifier_initialize
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_modifier_enable_tca_correction
int lf_modifier_enable_tca_correction(lfModifier *modifier, const lfLens *lens, float focal)
lf_modifier_enable_scaling
int lf_modifier_enable_scaling(lfModifier *modifier, float scale)
lfComponentRole
lfComponentRole
These constants define the role of every pixel component, four bits each. "pixel" refers here to a se...
Definition: lensfun.h:2210
lfPixelFormat
lfPixelFormat
A list of pixel formats supported by internal colour callbacks.
Definition: lensfun.h:2191
LF_MODIFY_TCA
@ LF_MODIFY_TCA
Definition: lensfun.h:2173
LF_MODIFY_VIGNETTING
@ LF_MODIFY_VIGNETTING
Definition: lensfun.h:2175
LF_MODIFY_GEOMETRY
@ LF_MODIFY_GEOMETRY
Definition: lensfun.h:2180
LF_MODIFY_DISTORTION
@ LF_MODIFY_DISTORTION
Definition: lensfun.h:2178
LF_MODIFY_PERSPECTIVE
@ LF_MODIFY_PERSPECTIVE
Definition: lensfun.h:2184
LF_MODIFY_SCALE
@ LF_MODIFY_SCALE
Definition: lensfun.h:2182
LF_MODIFY_ALL
@ LF_MODIFY_ALL
Definition: lensfun.h:2186
LF_CR_NEXT
@ LF_CR_NEXT
Definition: lensfun.h:2222
LF_CR_END
@ LF_CR_END
Definition: lensfun.h:2215
LF_CR_INTENSITY
@ LF_CR_INTENSITY
Definition: lensfun.h:2226
LF_CR_RED
@ LF_CR_RED
Definition: lensfun.h:2228
LF_CR_UNKNOWN
@ LF_CR_UNKNOWN
Definition: lensfun.h:2224
LF_CR_GREEN
@ LF_CR_GREEN
Definition: lensfun.h:2230
LF_CR_BLUE
@ LF_CR_BLUE
Definition: lensfun.h:2232
LF_PF_U16
@ LF_PF_U16
Definition: lensfun.h:2195
LF_PF_F64
@ LF_PF_F64
Definition: lensfun.h:2201
LF_PF_U8
@ LF_PF_U8
Definition: lensfun.h:2193
LF_PF_U32
@ LF_PF_U32
Definition: lensfun.h:2197
LF_PF_F32
@ LF_PF_F32
Definition: lensfun.h:2199
lf_db_find_cameras_ext
const lfCamera ** lf_db_find_cameras_ext(const lfDatabase *db, const char *maker, const char *model, int sflags)
lf_db_new
DEPRECATED lfDatabase * lf_db_new(void)
Create a new empty database object.
lf_db_save
char * lf_db_save(const lfMount *const *mounts, const lfCamera *const *cameras, const lfLens *const *lenses)
lf_db_get_cameras
const lfCamera *const * lf_db_get_cameras(lfDatabase *db)
lf_db_load_path
lfError lf_db_load_path(lfDatabase *db, const char *pathname)
lf_db_get_mounts
const lfMount *const * lf_db_get_mounts(lfDatabase *db)
lf_db_mount_name
const char * lf_db_mount_name(const lfDatabase *db, const char *mount)
lf_db_system_updates_location
const char *const lf_db_system_updates_location
lf_db_read_timestamp
long int lf_db_read_timestamp(lfDatabase *db, const char *dirname)
lf_db_find_mount
const lfMount * lf_db_find_mount(const lfDatabase *db, const char *mount)
lf_db_load_data
lfError lf_db_load_data(lfDatabase *db, const char *errcontext, const char *data, size_t data_size)
lf_db_load
lfError lf_db_load(lfDatabase *db)
lf_db_load_directory
DEPRECATED cbool lf_db_load_directory(lfDatabase *db, const char *dirname)
lf_db_find_lenses_hd
DEPRECATED const lfLens ** lf_db_find_lenses_hd(const lfDatabase *db, const lfCamera *camera, const char *maker, const char *lens, int sflags)
lf_db_save_all
lfError lf_db_save_all(const lfDatabase *db, const char *filename)
lf_db_get_lenses
const lfLens *const * lf_db_get_lenses(lfDatabase *db)
lf_db_save_file
lfError lf_db_save_file(const lfDatabase *db, const char *filename, const lfMount *const *mounts, const lfCamera *const *cameras, const lfLens *const *lenses)
lf_db_find_cameras
const lfCamera ** lf_db_find_cameras(const lfDatabase *db, const char *maker, const char *model)
lf_db_user_location
const char *const lf_db_user_location
lf_db_find_lenses
const lfLens ** lf_db_find_lenses(const lfDatabase *db, const lfCamera *camera, const char *maker, const char *lens, int sflags)
lf_db_system_location
const char *const lf_db_system_location
lf_db_load_file
DEPRECATED lfError lf_db_load_file(lfDatabase *db, const char *filename)
lf_db_user_updates_location
const char *const lf_db_user_updates_location
lf_db_create
lfDatabase * lf_db_create(void)
Create a new empty database object.
lf_db_destroy
void lf_db_destroy(lfDatabase *db)
Destroy the database object.
LF_SEARCH_LOOSE
@ LF_SEARCH_LOOSE
This flag selects a looser search algorithm resulting in more results (still sorted by score).
Definition: lensfun.h:1690
LF_SEARCH_SORT_AND_UNIQUIFY
@ 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
lf_lens_add_calib_crop
void lf_lens_add_calib_crop(lfLens *lens, const lfLensCalibCrop *cc)
lfTCAModel
lfTCAModel
The Lensfun library supports several models for lens lateral chromatic aberrations (also called trans...
Definition: lensfun.h:681
lf_lens_add_calib_vignetting
void lf_lens_add_calib_vignetting(lfLens *lens, const lfLensCalibVignetting *vc)
lf_lens_check
cbool lf_lens_check(lfLens *lens)
lf_lens_remove_calib_fov
DEPRECATED cbool lf_lens_remove_calib_fov(lfLens *lens, int idx)
lf_lens_remove_calib_crop
cbool lf_lens_remove_calib_crop(lfLens *lens, int idx)
lf_lens_add_calib_fov
DEPRECATED void lf_lens_add_calib_fov(lfLens *lens, const lfLensCalibFov *cf)
lf_lens_add_calib_distortion
void lf_lens_add_calib_distortion(lfLens *lens, const lfLensCalibDistortion *dc)
lf_lens_destroy
void lf_lens_destroy(lfLens *lens)
Destroy a lfLens object.
lf_lens_interpolate_crop
cbool lf_lens_interpolate_crop(const lfLens *lens, float crop, float focal, lfLensCalibCrop *res)
lf_lens_remove_calib_vignetting
cbool lf_lens_remove_calib_vignetting(lfLens *lens, int idx)
lf_lens_interpolate_distortion
cbool lf_lens_interpolate_distortion(const lfLens *lens, float crop, float focal, lfLensCalibDistortion *res)
lf_get_distortion_model_desc
const char * lf_get_distortion_model_desc(enum lfDistortionModel model, const char **details, const lfParameter ***params)
lfVignettingModel
lfVignettingModel
The Lensfun library supports several models for lens vignetting correction.
Definition: lensfun.h:778
lf_lens_add_mount
void lf_lens_add_mount(lfLens *lens, const char *val)
lf_lens_remove_calib_tca
cbool lf_lens_remove_calib_tca(lfLens *lens, int idx)
lf_lens_guess_parameters
void lf_lens_guess_parameters(lfLens *lens)
lfCropMode
lfCropMode
Different crop modes.
Definition: lensfun.h:835
lf_lens_interpolate_tca
cbool lf_lens_interpolate_tca(const lfLens *lens, float crop, float focal, lfLensCalibTCA *res)
lf_lens_interpolate_fov
DEPRECATED cbool lf_lens_interpolate_fov(const lfLens *lens, float crop, float focal, lfLensCalibFov *res)
lfDistortionModel
lfDistortionModel
The Lensfun library implements several lens distortion models. This enum lists them.
Definition: lensfun.h:564
lf_lens_remove_calibrations
void lf_lens_remove_calibrations(lfLens *lens)
lf_get_crop_desc
const char * lf_get_crop_desc(enum lfCropMode mode, const char **details, const lfParameter ***params)
lf_lens_get_mount_names
const char *const * lf_lens_get_mount_names(lfLens *lens)
lf_lens_new
DEPRECATED lfLens * lf_lens_new()
Create a new lens object.
lf_lens_copy
void lf_lens_copy(lfLens *dest, const lfLens *source)
Copy the data from one lfLens structure into another.
lfLensType
lfLensType
Lens type. See Change of projection for further information.
Definition: lensfun.h:993
lf_get_vignetting_model_desc
const char * lf_get_vignetting_model_desc(enum lfVignettingModel model, const char **details, const lfParameter ***params)
lf_lens_add_calib_tca
void lf_lens_add_calib_tca(lfLens *lens, const lfLensCalibTCA *tcac)
lf_get_lens_type_desc
const char * lf_get_lens_type_desc(enum lfLensType type, const char **details)
lf_get_tca_model_desc
const char * lf_get_tca_model_desc(enum lfTCAModel model, const char **details, const lfParameter ***params)
lf_lens_interpolate_vignetting
cbool lf_lens_interpolate_vignetting(const lfLens *lens, float crop, float focal, float aperture, float distance, lfLensCalibVignetting *res)
lf_lens_create
lfLens * lf_lens_create()
Create a new lens object.
lf_lens_remove_calib_distortion
cbool lf_lens_remove_calib_distortion(lfLens *lens, int idx)
LF_TCA_MODEL_NONE
@ LF_TCA_MODEL_NONE
No TCA correction data is known.
Definition: lensfun.h:683
LF_TCA_MODEL_LINEAR
@ LF_TCA_MODEL_LINEAR
Linear lateral chromatic aberrations model.
Definition: lensfun.h:695
LF_TCA_MODEL_POLY3
@ LF_TCA_MODEL_POLY3
Third order polynomial.
Definition: lensfun.h:707
LF_TCA_MODEL_ACM
@ LF_TCA_MODEL_ACM
Adobe camera model for TCA. The coordinate system is different here. Everything is measured in units ...
Definition: lensfun.h:735
LF_VIGNETTING_MODEL_PA
@ LF_VIGNETTING_MODEL_PA
Pablo D'Angelo vignetting model (which is a more general variant of the law).
Definition: lensfun.h:790
LF_VIGNETTING_MODEL_ACM
@ LF_VIGNETTING_MODEL_ACM
Adobe's vignetting model. It differs from D'Angelo's model only in the coordinate system....
Definition: lensfun.h:801
LF_VIGNETTING_MODEL_NONE
@ LF_VIGNETTING_MODEL_NONE
No vignetting correction data is known.
Definition: lensfun.h:780
LF_CROP_RECTANGLE
@ LF_CROP_RECTANGLE
use a rectangular crop
Definition: lensfun.h:839
LF_CROP_CIRCLE
@ LF_CROP_CIRCLE
use a circular crop, e.g. for circular fisheye images
Definition: lensfun.h:841
LF_NO_CROP
@ LF_NO_CROP
no crop at all
Definition: lensfun.h:837
LF_DIST_MODEL_POLY5
@ LF_DIST_MODEL_POLY5
5th order polynomial model.
Definition: lensfun.h:583
LF_DIST_MODEL_NONE
@ LF_DIST_MODEL_NONE
Distortion parameters are unknown.
Definition: lensfun.h:566
LF_DIST_MODEL_ACM
@ 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
LF_DIST_MODEL_PTLENS
@ LF_DIST_MODEL_PTLENS
PTLens model, which is also used by Hugin.
Definition: lensfun.h:591
LF_DIST_MODEL_POLY3
@ LF_DIST_MODEL_POLY3
3rd order polynomial model, which is a subset of the PTLens model.
Definition: lensfun.h:574
LF_FISHEYE
@ LF_FISHEYE
Equidistant fisheye.
Definition: lensfun.h:1006
LF_FISHEYE_EQUISOLID
@ LF_FISHEYE_EQUISOLID
Equisolid fisheye.
Definition: lensfun.h:1026
LF_FISHEYE_THOBY
@ LF_FISHEYE_THOBY
Fisheye as measured by Thoby (for Nikkor 10.5).
Definition: lensfun.h:1032
LF_UNKNOWN
@ LF_UNKNOWN
Unknown lens type.
Definition: lensfun.h:995
LF_FISHEYE_ORTHOGRAPHIC
@ LF_FISHEYE_ORTHOGRAPHIC
Orthographic fisheye.
Definition: lensfun.h:1022
LF_EQUIRECTANGULAR
@ LF_EQUIRECTANGULAR
Equirectangular.
Definition: lensfun.h:1020
LF_RECTILINEAR
@ LF_RECTILINEAR
Rectilinear lens.
Definition: lensfun.h:1000
LF_FISHEYE_STEREOGRAPHIC
@ LF_FISHEYE_STEREOGRAPHIC
Stereographic fisheye.
Definition: lensfun.h:1024
LF_PANORAMIC
@ LF_PANORAMIC
Panoramic (cylindrical)
Definition: lensfun.h:1013
lf_mount_destroy
void lf_mount_destroy(lfMount *mount)
Destroy a lfMount object.
lf_mount_create
lfMount * lf_mount_create()
Create a new mount object.
lf_mount_add_compat
void lf_mount_add_compat(lfMount *mount, const char *val)
lf_mount_new
DEPRECATED lfMount * lf_mount_new()
Create a new mount object.
lf_mount_copy
void lf_mount_copy(lfMount *dest, const lfMount *source)
Copy the data from one lfMount structure into another.
lf_mount_get_compats
const char *const * lf_mount_get_compats(lfMount *mount)
lf_mount_check
cbool lf_mount_check(lfMount *mount)
C_TYPEDEF
#define C_TYPEDEF(t, c)
Definition: lensfun.h:45
lfCamera
Camera data. Unknown fields are set to NULL.
Definition: lensfun.h:366
lfCamera::Model
lfMLstr Model
Model name (ex: "Rolleiflex SL35") – same as in EXIF.
Definition: lensfun.h:370
lfCamera::Variant
lfMLstr Variant
Camera variant. Some cameras use same EXIF id for different models.
Definition: lensfun.h:372
lfCamera::~lfCamera
~lfCamera()
Destroy a camera object. All allocated fields are freed.
lfCamera::Score
int Score
Camera matching score, used while searching: not actually a camera parameter.
Definition: lensfun.h:378
lfCamera::Check
bool Check()
Check if a camera object is valid.
lfCamera::Maker
lfMLstr Maker
Camera maker (ex: "Rollei") – same as in EXIF.
Definition: lensfun.h:368
lfCamera::SetVariant
void SetVariant(const char *val, const char *lang=NULL)
Add a string to camera variant.
lfCamera::lfCamera
lfCamera(const lfCamera &other)
lfCamera::lfCamera
lfCamera()
Initialize a new camera object. All fields are set to 0.
lfCamera::SetMaker
void SetMaker(const char *val, const char *lang=NULL)
Add a string to camera maker.
lfCamera::Mount
char * Mount
Camera mount type (ex: "QBM")
Definition: lensfun.h:374
lfCamera::SetMount
void SetMount(const char *val)
Set the value for camera Mount.
lfCamera::SetModel
void SetModel(const char *val, const char *lang=NULL)
Add a string to camera model.
lfCamera::CropFactor
float CropFactor
Camera crop factor (ex: 1.0). Must be defined.
Definition: lensfun.h:376
lfDatabase
A lens database object.
Definition: lensfun.h:1719
lfDatabase::~lfDatabase
~lfDatabase()
Database object destructor.
lfDatabase::Save
lfError Save(const char *filename) const
Save the whole database to a file.
lfDatabase::Save
char * Save() const
Save the database into a memory array.
lfDatabase::AddMount
void AddMount(lfMount *mount)
Add a mount to the database.
lfDatabase::SystemLocation
static const char *const SystemLocation
System lens database directory (something like "/usr/share/lensfun")
Definition: lensfun.h:1733
lfDatabase::GetMounts
const lfMount *const * GetMounts()
Retrieve a full list of mounts.
lfDatabase::FindCamerasExt
const lfCamera ** FindCamerasExt(const char *maker, const char *model, int sflags=0) const
Searches all translations of camera maker and model.
lfDatabase::FindLenses
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....
lfDatabase::Create
static DEPRECATED lfDatabase * Create()
Create a new empty database object.
lfDatabase::UserUpdatesDir
DEPRECATED char * UserUpdatesDir
Home lens database directory for automatic updates (deprecated). Replaced by lfDatabase::UserUpdatesL...
Definition: lensfun.h:1723
lfDatabase::LoadDirectory
DEPRECATED bool LoadDirectory(const char *dirname)
Open and parse all XML files in a given directory.
lfDatabase::lfDatabase
lfDatabase()
Database object constructor.
lfDatabase::ReadTimestamp
static long int ReadTimestamp(const char *dirname)
Scans for the timestamp of a Lensfun database.
lfDatabase::UserLocation
static const char *const UserLocation
Home lens database directory (something like "~/.local/share/lensfun")
Definition: lensfun.h:1728
lfDatabase::UserUpdatesLocation
static const char *const UserUpdatesLocation
Home lens database directory for automatic updates (something like "~/.local/share/lensfun/updates")
Definition: lensfun.h:1731
lfDatabase::HomeDataDir
DEPRECATED char * HomeDataDir
Home lens database directory (deprecated). Replaced by lfDatabase::UserLocation.
Definition: lensfun.h:1721
lfDatabase::AddCamera
void AddCamera(lfCamera *camera)
Add a camera to the database.
lfDatabase::FindMount
const lfMount * FindMount(const char *mount) const
Return the lfMount structure given the (basic) mount name.
lfDatabase::Destroy
DEPRECATED void Destroy()
Destroy the database object and free all loaded data.
lfDatabase::AddLens
void AddLens(lfLens *lens)
Add a lens to the database.
lfDatabase::GetCameras
const lfCamera *const * GetCameras()
Retrieve a full list of cameras.
lfDatabase::Load
lfError Load()
Find and load the lens database.
lfDatabase::MountName
const char * MountName(const char *mount) const
Get the name of a mount in current locale.
lfDatabase::SystemUpdatesLocation
static const char *const SystemUpdatesLocation
System lens database directory for automatic updates (something like "/var/lib/lensfun-updates")
Definition: lensfun.h:1736
lfDatabase::GetLenses
const lfLens *const * GetLenses()
Retrieve a full list of lenses.
lfDatabase::FindCameras
const lfCamera ** FindCameras(const char *maker, const char *model) const
Find a set of cameras that fit given criteria.
lfDatabase::Load
lfError Load(const char *data, size_t data_size)
Load a database from memory.
lfDatabase::Load
lfError Load(const char *pathname)
Load the database from specific path (directory or file).
lfLensCalibAttributes
Lens calibration attributes.
Definition: lensfun.h:519
lfLensCalibAttributes::AspectRatio
float AspectRatio
Definition: lensfun.h:535
lfLensCalibAttributes::CropFactor
float CropFactor
Definition: lensfun.h:533
lfLensCalibAttributes::CenterX
float CenterX
Definition: lensfun.h:529
lfLensCalibAttributes::CenterY
float CenterY
Definition: lensfun.h:531
lfLensCalibCrop
Struct to save image crop, which can depend on the focal length.
Definition: lensfun.h:850
lfLensCalibCrop::CropMode
enum lfCropMode CropMode
crop mode which should be applied to image to get rid of black borders
Definition: lensfun.h:854
lfLensCalibCrop::Focal
float Focal
Focal length in mm at which this calibration data was taken.
Definition: lensfun.h:852
lfLensCalibCrop::CalibAttr
lfLensCalibAttributes CalibAttr
Pointer to the calibration settings (currently unused).
Definition: lensfun.h:865
lfLensCalibDistortion
Lens distortion calibration data.
Definition: lensfun.h:620
lfLensCalibDistortion::Model
enum lfDistortionModel Model
The type of distortion model used.
Definition: lensfun.h:622
lfLensCalibDistortion::Focal
float Focal
Nominal focal length in mm at which this calibration data was taken.
Definition: lensfun.h:625
lfLensCalibDistortion::CalibAttr
lfLensCalibAttributes CalibAttr
Calibration settings (currently unused).
Definition: lensfun.h:662
lfLensCalibDistortion::RealFocalMeasured
cbool RealFocalMeasured
Whether the real focal length was actually measured.
Definition: lensfun.h:658
lfLensCalibDistortion::RealFocal
float RealFocal
Real focal length in mm for this nominal focal length.
Definition: lensfun.h:655
lfLensCalibFov
Struct to save calibrated field of view, which can depends on the focal length (DEPRECATED)
Definition: lensfun.h:878
lfLensCalibFov::FieldOfView
float FieldOfView
Field of view for given images.
Definition: lensfun.h:890
lfLensCalibFov::Focal
float Focal
Definition: lensfun.h:880
lfLensCalibFov::CalibAttr
lfLensCalibAttributes CalibAttr
Pointer to the calibration settings (currently unused).
Definition: lensfun.h:892
lfLensCalibTCA
Laterlal chromatic aberrations calibration data.
Definition: lensfun.h:748
lfLensCalibTCA::CalibAttr
lfLensCalibAttributes CalibAttr
Pointer to the calibration settings (currently unused).
Definition: lensfun.h:756
lfLensCalibTCA::Focal
float Focal
Focal length in mm at which this calibration data was taken.
Definition: lensfun.h:752
lfLensCalibTCA::Model
enum lfTCAModel Model
The lateral chromatic aberration model used.
Definition: lensfun.h:750
lfLensCalibVignetting
Lens vignetting calibration data.
Definition: lensfun.h:814
lfLensCalibVignetting::CalibAttr
lfLensCalibAttributes CalibAttr
Pointer to the calibration settings (currently unused).
Definition: lensfun.h:826
lfLensCalibVignetting::Distance
float Distance
Focus distance in meters.
Definition: lensfun.h:822
lfLensCalibVignetting::Aperture
float Aperture
Aperture (f-number) at which this calibration data was taken.
Definition: lensfun.h:820
lfLensCalibVignetting::Model
enum lfVignettingModel Model
The lens vignetting model used.
Definition: lensfun.h:816
lfLensCalibVignetting::Focal
float Focal
Focal length in mm at which this calibration data was taken.
Definition: lensfun.h:818
lfLensCalibrationSet
A set of calibration data.
Definition: lensfun.h:905
lfLensCalibrationSet::Attributes
lfLensCalibAttributes Attributes
Definition: lensfun.h:907
lfLens
Lens data. Unknown fields are set to NULL or 0.
Definition: lensfun.h:1047
lfLens::CalibVignetting
DEPRECATED lfLensCalibVignetting ** CalibVignetting
Definition: lensfun.h:1085
lfLens::Model
lfMLstr Model
Definition: lensfun.h:1051
lfLens::InterpolateTCA
DEPRECATED bool InterpolateTCA(float focal, lfLensCalibTCA &res) const
Interpolate lens TCA calibration data for given focal length.
lfLens::GetLensTypeDesc
static const char * GetLensTypeDesc(lfLensType type, const char **details)
Get the human-readable lens type name and a short description of this lens type.
lfLens::RemoveCalibFov
DEPRECATED bool RemoveCalibFov(int idx)
Remove a field of view entry from the lens fov structure.
lfLens::GuessParameters
void GuessParameters()
This method fills some fields if they are missing but can be derived from other fields.
lfLens::RemoveCalibVignetting
DEPRECATED bool RemoveCalibVignetting(int idx)
Remove a calibration entry from the vignetting calibration data.
lfLens::Check
bool Check()
Check if a lens object is valid.
lfLens::AddMount
void AddMount(const char *val)
Add a new mount type to this lens.
lfLens::CalibDistortion
DEPRECATED lfLensCalibDistortion ** CalibDistortion
Definition: lensfun.h:1081
lfLens::AspectRatio
DEPRECATED float AspectRatio
Definition: lensfun.h:1079
lfLens::InterpolateFov
DEPRECATED bool InterpolateFov(float crop, float focal, lfLensCalibFov &res) const
Interpolate lens fov data for given focal length.
lfLens::Score
int Score
Definition: lensfun.h:1091
lfLens::Maker
lfMLstr Maker
Definition: lensfun.h:1049
lfLens::AddCalibDistortion
void AddCalibDistortion(const lfLensCalibDistortion *lcd)
Add a new distortion calibration structure to the pool.
lfLens::GetDistortionModelDesc
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 ...
lfLens::lfLens
lfLens(const lfLens &other)
lfLens::InterpolateDistortion
DEPRECATED bool InterpolateDistortion(float focal, lfLensCalibDistortion &res) const
Interpolate lens geometry distortion data for given focal length.
lfLens::InterpolateDistortion
bool InterpolateDistortion(float crop, float focal, lfLensCalibDistortion &res) const
Interpolate lens geometry distortion data for given focal length and crop factor.
lfLens::RemoveCalibrations
void RemoveCalibrations()
Remove all calibrations from the lens.
lfLens::InterpolateVignetting
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.
lfLens::CropFactor
DEPRECATED float CropFactor
Definition: lensfun.h:1077
lfLens::InterpolateVignetting
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.
lfLens::InterpolateTCA
bool InterpolateTCA(float crop, float focal, lfLensCalibTCA &res) const
Interpolate lens TCA calibration data for given focal length.
lfLens::GetCropDesc
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.
lfLens::SetModel
void SetModel(const char *val, const char *lang=NULL)
Add a string to camera model.
lfLens::AddCalibCrop
void AddCalibCrop(const lfLensCalibCrop *lcc)
Add a new lens crop structure to the pool.
lfLens::SetMaker
void SetMaker(const char *val, const char *lang=NULL)
Add a string to camera maker.
lfLens::GetCalibrationSets
const lfLensCalibrationSet *const * GetCalibrationSets() const
Get a list of all calibration sets.
lfLens::Mounts
DEPRECATED char ** Mounts
Definition: lensfun.h:1061
lfLens::RemoveCalibDistortion
DEPRECATED bool RemoveCalibDistortion(int idx)
Remove a calibration entry from the distortion calibration data.
lfLens::MinFocal
float MinFocal
Definition: lensfun.h:1053
lfLens::CenterY
DEPRECATED float CenterY
Definition: lensfun.h:1075
lfLens::GetMountNames
const char *const * GetMountNames() const
Get a list of all mount names.
lfLens::lfLens
lfLens()
Create a new lens object, initializing all fields to default values.
lfLens::MaxFocal
float MaxFocal
Definition: lensfun.h:1055
lfLens::AddCalibVignetting
void AddCalibVignetting(const lfLensCalibVignetting *lcv)
Add a new vignetting calibration structure to the pool.
lfLens::InterpolateCrop
bool InterpolateCrop(float crop, float focal, lfLensCalibCrop &res) const
Interpolate lens crop data for given focal length.
lfLens::MinAperture
float MinAperture
Definition: lensfun.h:1057
lfLens::RemoveCalibTCA
DEPRECATED bool RemoveCalibTCA(int idx)
Remove a calibration entry from the TCA calibration data.
lfLens::CalibTCA
DEPRECATED lfLensCalibTCA ** CalibTCA
Definition: lensfun.h:1083
lfLens::GetTCAModelDesc
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...
lfLens::CalibFov
DEPRECATED lfLensCalibFov ** CalibFov
Definition: lensfun.h:1089
lfLens::MaxAperture
float MaxAperture
Definition: lensfun.h:1059
lfLens::AddCalibTCA
void AddCalibTCA(const lfLensCalibTCA *lctca)
Add a new transversal chromatic aberration calibration structure to the pool.
lfLens::AddCalibFov
DEPRECATED void AddCalibFov(const lfLensCalibFov *lcf)
Add a new lens fov structure to the pool.
lfLens::~lfLens
~lfLens()
Destroy this and all associated objects.
lfLens::InterpolateFov
DEPRECATED bool InterpolateFov(float focal, lfLensCalibFov &res) const
Interpolate lens fov data for given focal length.
lfLens::GetVignettingModelDesc
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 ...
lfLens::RemoveCalibCrop
DEPRECATED bool RemoveCalibCrop(int idx)
Remove a lens crop entry from the lens crop structure.
lfLens::CalibCrop
DEPRECATED lfLensCalibCrop ** CalibCrop
Definition: lensfun.h:1087
lfLens::Type
lfLensType Type
Definition: lensfun.h:1063
lfLens::InterpolateCrop
DEPRECATED bool InterpolateCrop(float focal, lfLensCalibCrop &res) const
Interpolate lens crop data for given focal length.
lfLens::CenterX
DEPRECATED float CenterX
Definition: lensfun.h:1073
lfModifier
A modifier object contains optimized data required to rectify a image.
Definition: lensfun.h:2351
lfModifier::Initialize
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.
lfModifier::EnableScaling
int EnableScaling(float scale)
Enable image scaling.
lfModifier::EnableVignettingCorrection
int EnableVignettingCorrection(const lfLensCalibVignetting &lcv)
Enable vignetting correction.
lfModifier::EnableVignettingCorrection
int EnableVignettingCorrection(const lfLens *lens, float focal, float aperture, float distance)
Enable vignetting correction.
lfModifier::lfModifier
lfModifier(float imgcrop, int imgwidth, int imgheight, lfPixelFormat pixel_format, bool reverse=false)
Create an empty image modifier object.
lfModifier::EnableProjectionTransform
int EnableProjectionTransform(const lfLens *lens, float focal, lfLensType target_projection)
Enable projection transform.
lfModifier::ApplySubpixelGeometryDistortion
bool ApplySubpixelGeometryDistortion(float xu, float yu, int width, int height, float *res) const
Apply stage 2 & 3 in one step.
lfModifier::ApplyColorModification
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.
lfModifier::ApplyGeometryDistortion
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.
lfModifier::~lfModifier
~lfModifier()
Modifier object destructor.
lfModifier::EnableDistortionCorrection
int EnableDistortionCorrection(const lfLensCalibDistortion &lcd)
Enable distortion correction.
lfModifier::EnablePerspectiveCorrection
int EnablePerspectiveCorrection(const lfLens *lens, float focal, float *x, float *y, int count, float d)
Enable the perspective correction.
lfModifier::EnableTCACorrection
int EnableTCACorrection(const lfLens *lens, float focal)
Enable TCA correction.
lfModifier::Destroy
DEPRECATED void Destroy()
Destroy the modifier object.
lfModifier::ApplySubpixelDistortion
bool ApplySubpixelDistortion(float xu, float yu, int width, int height, float *res) const
Image correction step 3: apply subpixel distortions.
lfModifier::lfModifier
DEPRECATED lfModifier(const lfLens *lens, float crop, int width, int height)
Create an empty image modifier object.
lfModifier::EnableTCACorrection
int EnableTCACorrection(const lfLensCalibTCA &lctca)
Enable TCA correction.
lfModifier::GetAutoScale
float GetAutoScale(bool reverse)
Compute the automatic scale factor for the image.
lfModifier::EnableDistortionCorrection
int EnableDistortionCorrection(const lfLens *lens, float focal)
Enable distortion correction.
lfModifier::Create
static DEPRECATED lfModifier * Create(const lfLens *lens, float crop, int width, int height)
Create an empty image modifier object.
lfMount
This structure contains everything specific to a camera mount.
Definition: lensfun.h:219
lfMount::AddCompat
void AddCompat(const char *val)
Add a mount name to the list of compatible mounts.
lfMount::Check
bool Check()
Check if a mount object is valid.
lfMount::lfMount
lfMount()
Initialize a new mount object. All fields are set to 0.
lfMount::Compat
DEPRECATED char ** Compat
Definition: lensfun.h:227
lfMount::GetCompats
const char *const * GetCompats() const
Return a list of compatible mounts.
lfMount::lfMount
lfMount(const lfMount &other)
lfMount::Name
lfMLstr Name
Camera mount name.
Definition: lensfun.h:225
lfMount::SetName
void SetName(const char *val, const char *lang=NULL)
Add a string to mount name.
lfMount::~lfMount
~lfMount()
Destroy a mount object. All allocated fields are freed.
lfParameter
This structure describes a single parameter for some lens model.
Definition: lensfun.h:976
lfParameter::Name
const char * Name
Parameter name (something like 'k', 'k3', 'omega' etc.)
Definition: lensfun.h:978
lfParameter::Max
float Max
Maximal value that has sense.
Definition: lensfun.h:982
lfParameter::Min
float Min
Minimal value that has sense.
Definition: lensfun.h:980
lfParameter::Default
float Default
Default value for the parameter.
Definition: lensfun.h:984