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 
43 extern "C" {
45 # define C_TYPEDEF(t,c)
46 #else
47 # define C_TYPEDEF(t,c) typedef t c c;
48 #endif
49 
55 /*----------------------------------------------------------------------------*/
56 
63 #define LF_VERSION_MAJOR 0
65 #define LF_VERSION_MINOR 3
67 #define LF_VERSION_MICRO 95
69 #define LF_VERSION_BUGFIX 0
71 #define LF_VERSION ((LF_VERSION_MAJOR << 24) | (LF_VERSION_MINOR << 16) | (LF_VERSION_MICRO << 8) | LF_VERSION_BUGFIX)
73 
75 #define LF_MIN_DATABASE_VERSION 0
76 #define LF_MAX_DATABASE_VERSION 2
78 
79 #if defined CONF_LENSFUN_STATIC
80 # 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
101 # 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 
129 {
136 };
137 
138 C_TYPEDEF (enum, lfError)
139 
140 
141 typedef unsigned char lf_u8;
143 typedef unsigned short lf_u16;
145 typedef unsigned int lf_u32;
147 typedef float lf_f32;
149 typedef 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 
219 {
225  lfMLstr Name;
228 
229 #ifdef __cplusplus
230 
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 
286 private:
287  std::vector<char*> MountCompat;
288 #endif
289 };
290 
291 C_TYPEDEF (struct, lfMount)
292 
293 
303 
312 
322 LF_EXPORT void lf_mount_destroy (lfMount *mount);
323 
333 LF_EXPORT void lf_mount_copy (lfMount *dest, const lfMount *source);
334 
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 
366 {
368  lfMLstr Maker;
370  lfMLstr Model;
372  lfMLstr Variant;
374  char *Mount;
376  float CropFactor;
378  int Score;
379 
380 #ifdef __cplusplus
381 
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 
465 
475 
485 LF_EXPORT void lf_camera_destroy (lfCamera *camera);
486 
496 LF_EXPORT void lf_camera_copy (lfCamera *dest, const lfCamera *source);
497 
500 
503 /*----------------------------------------------------------------------------*/
504 
519 {
521  float CropFactor;
523  float AspectRatio;
524 
525  #ifdef __cplusplus
526  bool operator==(const lfLensCalibAttributes& other)
527  {
528  return CropFactor == other.CropFactor &&
529  AspectRatio == other.AspectRatio;
530  }
531  #endif
532 };
533 
535 
536 
550 {
595 };
596 
598 
599 
606 {
608  enum lfDistortionModel Model;
611  float Focal;
641  float RealFocal;
646  float Terms [5];
649 };
650 
652 
653 
667 {
722 };
723 
724 C_TYPEDEF (enum, lfTCAModel)
725 
726 
734 {
736  enum lfTCAModel Model;
738  float Focal;
740  float Terms [12];
743 };
744 
745 C_TYPEDEF (struct, lfLensCalibTCA)
746 
747 
764 {
788 };
789 
791 
792 
800 {
802  enum lfVignettingModel Model;
804  float Focal;
806  float Aperture;
808  float Distance;
810  float Terms [3];
813 };
814 
816 
817 
821 {
828 };
829 
830 C_TYPEDEF(enum, lfCropMode)
831 
832 
836 {
838  float Focal;
840  enum lfCropMode CropMode;
849  float Crop [4];
852 };
853 
854 C_TYPEDEF (struct, lfLensCalibCrop)
855 
856 
864 {
866  float Focal;
876  float FieldOfView;
879 };
880 
881 C_TYPEDEF (struct, lfLensCalibFov)
882 
883 
891 {
894 
895 #ifdef __cplusplus
896  lfLensCalibrationSet(lfLensCalibAttributes attributes) : Attributes(attributes) {}
897 
898  lfLensCalibrationSet(const lfLensCalibrationSet &other)
899  {
900  Attributes = other.Attributes;
901  for (auto *cb : other.CalibDistortion)
902  CalibDistortion.push_back(new lfLensCalibDistortion(*cb));
903  for (auto *cb : other.CalibVignetting)
904  CalibVignetting.push_back(new lfLensCalibVignetting(*cb));
905  for (auto *cb : other.CalibTCA)
906  CalibTCA.push_back(new lfLensCalibTCA(*cb));
907  for (auto *cb : other.CalibCrop)
908  CalibCrop.push_back(new lfLensCalibCrop(*cb));
909  for (auto *cb : other.CalibFov)
910  CalibFov.push_back(new lfLensCalibFov(*cb));
911  }
912 
913  ~lfLensCalibrationSet()
914  {
915  for (auto cb : CalibDistortion)
916  delete cb;
917  for (auto cb : CalibVignetting)
918  delete cb;
919  for (auto cb : CalibTCA)
920  delete cb;
921  for (auto cb : CalibCrop)
922  delete cb;
923  for (auto cb : CalibFov)
924  delete cb;
925  }
926 
927  bool Empty() const
928  {
929  return CalibDistortion.empty() && CalibTCA.empty() && CalibVignetting.empty() &&
930  CalibCrop.empty() && CalibFov.empty();
931  }
932 
933  bool HasDistortion() const { return !CalibDistortion.empty(); }
934  bool HasTCA() const { return !CalibTCA.empty(); }
935  bool HasVignetting() const { return !CalibVignetting.empty(); }
936  bool HasCrop() const { return !CalibCrop.empty(); }
937  bool HasFov() const { return !CalibFov.empty(); }
938 
939  private:
940 
942  std::vector<lfLensCalibDistortion*> CalibDistortion;
944  std::vector<lfLensCalibTCA*> CalibTCA;
946  std::vector<lfLensCalibVignetting*> CalibVignetting;
948  std::vector<lfLensCalibCrop*> CalibCrop;
950  std::vector<lfLensCalibFov*> CalibFov;
951 
952  friend struct lfDatabase;
953  friend struct lfLens;
954 #endif
955 };
956 
957 
962 {
964  const char *Name;
966  float Min;
968  float Max;
970  float Default;
971 };
972 
973 C_TYPEDEF (struct, lfParameter)
974 
975 
979 {
1019 };
1020 
1021 C_TYPEDEF (enum, lfLensType)
1022 
1023 
1033 {
1039  float MinFocal;
1041  float MaxFocal;
1059  float CenterX;
1061  float CenterY;
1077  int Score;
1078 
1079 #ifdef __cplusplus
1080 
1084  lfLens ();
1085 
1089  lfLens (const lfLens &other);
1090 
1094  ~lfLens ();
1095 
1099  lfLens &operator = (const lfLens &other);
1100 
1111  void SetMaker (const char *val, const char *lang = NULL);
1112 
1123  void SetModel (const char *val, const char *lang = NULL);
1124 
1132  void AddMount (const char *val);
1133 
1142  void AddCalibDistortion (const lfLensCalibDistortion *lcd);
1143 
1149  DEPRECATED bool RemoveCalibDistortion (int idx);
1150 
1160  void AddCalibTCA (const lfLensCalibTCA *lctca);
1161 
1167  DEPRECATED bool RemoveCalibTCA (int idx);
1168 
1177  void AddCalibVignetting (const lfLensCalibVignetting *lcv);
1178 
1184  DEPRECATED bool RemoveCalibVignetting (int idx);
1185 
1194  void AddCalibCrop (const lfLensCalibCrop *lcc);
1195 
1201  DEPRECATED bool RemoveCalibCrop (int idx);
1202 
1214  DEPRECATED void AddCalibFov (const lfLensCalibFov *lcf);
1215 
1225  DEPRECATED bool RemoveCalibFov (int idx);
1226 
1231  void RemoveCalibrations();
1232 
1241  void GuessParameters ();
1242 
1248  bool Check ();
1249 
1265  static const char *GetDistortionModelDesc (
1266  lfDistortionModel model, const char **details, const lfParameter ***params);
1282  static const char *GetTCAModelDesc (
1283  lfTCAModel model, const char **details, const lfParameter ***params);
1284 
1300  static const char *GetVignettingModelDesc (
1301  lfVignettingModel model, const char **details, const lfParameter ***params);
1302 
1318  static const char *GetCropDesc (
1319  lfCropMode mode, const char **details, const lfParameter ***params);
1320 
1332  static const char *GetLensTypeDesc (lfLensType type, const char **details);
1333 
1344  DEPRECATED bool InterpolateDistortion (float focal, lfLensCalibDistortion &res) const;
1345 
1359  bool InterpolateDistortion (float crop, float focal, lfLensCalibDistortion &res) const;
1360 
1371  DEPRECATED bool InterpolateTCA (float focal, lfLensCalibTCA &res) const;
1372 
1385  bool InterpolateTCA (float crop, float focal, lfLensCalibTCA &res) const;
1386 
1403  DEPRECATED bool InterpolateVignetting (
1404  float focal, float aperture, float distance, lfLensCalibVignetting &res) const;
1405 
1424  bool InterpolateVignetting (
1425  float crop, float focal, float aperture, float distance, lfLensCalibVignetting &res) const;
1426 
1437  DEPRECATED bool InterpolateCrop (float focal, lfLensCalibCrop &res) const;
1438 
1451  bool InterpolateCrop (float crop, float focal, lfLensCalibCrop &res) const;
1452 
1466  DEPRECATED bool InterpolateFov (float focal, lfLensCalibFov &res) const;
1467 
1483  DEPRECATED bool InterpolateFov (float crop, float focal, lfLensCalibFov &res) const;
1484 
1503  int AvailableModifications(float crop) const;
1504 
1511  const lfLensCalibrationSet* const* GetCalibrationSets() const;
1512 
1519  const char* const* GetMountNames() const;
1520 
1521  private:
1522  void UpdateLegacyCalibPointers();
1523 
1524  std::vector<lfLensCalibrationSet*> Calibrations;
1525  std::vector<char*> MountNames;
1526 
1527  lfLensCalibrationSet* GetClosestCalibrationSet(const float crop) const;
1528  lfLensCalibrationSet* GetCalibrationSetForAttributes(const lfLensCalibAttributes lcattr);
1529 
1530  friend struct lfDatabase;
1531 #endif
1532 };
1533 
1534 C_TYPEDEF (struct, lfLens)
1535 
1536 
1546 
1556 
1566 LF_EXPORT void lf_lens_destroy (lfLens *lens);
1567 
1577 LF_EXPORT void lf_lens_copy (lfLens *dest, const lfLens *source);
1578 
1581 
1584 
1586 LF_EXPORT void lf_lens_add_mount (lfLens *lens, const char *val);
1587 
1589 LF_EXPORT const char* const* lf_lens_get_mount_names (const lfLens *lens);
1590 
1593  enum lfDistortionModel model, const char **details, const lfParameter ***params);
1594 
1596 LF_EXPORT const char *lf_get_tca_model_desc (
1597  enum lfTCAModel model, const char **details, const lfParameter ***params);
1598 
1601  enum lfVignettingModel model, const char **details, const lfParameter ***params);
1602 
1604 LF_EXPORT const char *lf_get_crop_desc (
1605  enum lfCropMode mode, const char **details, const lfParameter ***params);
1606 
1608 LF_EXPORT const char *lf_get_lens_type_desc (
1609  enum lfLensType type, const char **details);
1610 
1612 LF_EXPORT cbool lf_lens_interpolate_distortion (const lfLens *lens, float crop, float focal,
1613  lfLensCalibDistortion *res);
1614 
1616 LF_EXPORT cbool lf_lens_interpolate_tca (const lfLens *lens, float crop, float focal, lfLensCalibTCA *res);
1617 
1619 LF_EXPORT cbool lf_lens_interpolate_vignetting (const lfLens *lens, float crop, float focal, float aperture,
1620  float distance, lfLensCalibVignetting *res);
1621 
1623 LF_EXPORT cbool lf_lens_interpolate_crop (const lfLens *lens, float crop, float focal,
1624  lfLensCalibCrop *res);
1625 
1627 DEPRECATED LF_EXPORT cbool lf_lens_interpolate_fov (const lfLens *lens, float crop, float focal,
1628  lfLensCalibFov *res);
1629 
1632 
1635 
1637 LF_EXPORT void lf_lens_add_calib_tca (lfLens *lens, const lfLensCalibTCA *tcac);
1638 
1641 
1644 
1647 
1649 LF_EXPORT void lf_lens_add_calib_crop (lfLens *lens, const lfLensCalibCrop *cc);
1650 
1653 
1656 
1659 
1662 
1664 LF_EXPORT int lf_lens_available_modifications (lfLens *lens, float crop);
1665 
1668 /*----------------------------------------------------------------------------*/
1669 
1679 enum
1680 {
1701 };
1702 
1717 {
1722 
1723 #ifdef __cplusplus
1724 
1726  static const char *const UserLocation;
1729  static const char *const UserUpdatesLocation;
1731  static const char *const SystemLocation;
1734  static const char *const SystemUpdatesLocation;
1735 
1737  lfDatabase ();
1739  ~lfDatabase ();
1740 
1747  DEPRECATED static lfDatabase *Create ();
1748 
1755  DEPRECATED void Destroy ();
1756 
1770  static long int ReadTimestamp (const char *dirname);
1771 
1786  DEPRECATED bool LoadDirectory (const char *dirname);
1787 
1796  lfError Load ();
1797 
1811  lfError Load (const char *pathname);
1812 
1823  lfError Load (const char *xml, size_t data_size);
1824 
1832  lfError Save (const char *filename) const;
1833 
1840  DEPRECATED char *Save () const;
1841 
1852  lfError Save (char*& xml, size_t& data_size) const;
1853 
1878  const lfCamera **FindCameras (const char *maker, const char *model) const;
1879 
1900  const lfCamera **FindCamerasExt (const char *maker, const char *model,
1901  int sflags = 0) const;
1902 
1910  const lfCamera *const *GetCameras ();
1911 
1949  const lfLens **FindLenses (const lfCamera *camera, const char *maker,
1950  const char *model, int sflags = 0) const;
1951 
1959  const lfLens *const *GetLenses ();
1960 
1968  const lfMount *FindMount (const char *mount) const;
1969 
1977  const char *MountName (const char *mount) const;
1978 
1986  const lfMount *const *GetMounts ();
1987 
1996  void AddMount (lfMount *mount);
1997 
2006  void AddCamera (lfCamera *camera);
2007 
2016  void AddLens (lfLens *lens);
2017 
2018 private:
2019 
2046  int MatchScore (const lfLens *pattern, const lfLens *match, const lfCamera *camera,
2047  void *fuzzycmp, const char* const* compat_mounts) const;
2048 
2049  lfError Load (const char *errcontext, const char *data, size_t data_size);
2050 
2051  std::vector<lfMount*> Mounts;
2052  std::vector<lfCamera*> Cameras;
2053  std::vector<lfLens*> Lenses;
2054 #endif
2055 };
2056 
2057 C_TYPEDEF (struct, lfDatabase)
2058 
2059 
2060 extern const char* const lf_db_system_location;
2062 extern const char* const lf_db_system_updates_location;
2064 extern const char* const lf_db_user_location;
2066 extern const char* const lf_db_user_updates_location;
2067 
2078 
2090 
2101 
2103 LF_EXPORT long int lf_db_read_timestamp (const char *dirname);
2104 
2107 
2109 DEPRECATED LF_EXPORT lfError lf_db_load_file (lfDatabase *db, const char *filename);
2110 
2112 DEPRECATED LF_EXPORT cbool lf_db_load_directory (lfDatabase *db, const char *dirname);
2113 
2115 LF_EXPORT lfError lf_db_load_path (lfDatabase *db, const char *pathname);
2116 
2118 DEPRECATED LF_EXPORT lfError lf_db_load_data (lfDatabase *db, const char *errcontext, const char *data, size_t data_size);
2119 
2121 LF_EXPORT lfError lf_db_load_str (lfDatabase *db, const char *xml, size_t data_size);
2122 
2124 LF_EXPORT lfError lf_db_save_all (const lfDatabase *db, const char *filename);
2125 
2127 LF_EXPORT lfError lf_db_save_str (const lfDatabase *db, char **xml, size_t* data_size);
2128 
2131  const lfDatabase *db, const char *maker, const char *model);
2132 
2135  const lfDatabase *db, const char *maker, const char *model, int sflags);
2136 
2138 LF_EXPORT const lfCamera *const *lf_db_get_cameras (lfDatabase *db);
2139 
2142  const lfDatabase *db, const lfCamera *camera, const char *maker,
2143  const char *lens, int sflags);
2144 
2147  const lfDatabase *db, const lfCamera *camera,
2148  const char *maker, const char *lens, int sflags);
2149 
2151 LF_EXPORT const lfLens *const *lf_db_get_lenses (lfDatabase *db);
2152 
2154 LF_EXPORT const lfMount *lf_db_find_mount (const lfDatabase *db, const char *mount);
2155 
2157 LF_EXPORT const char *lf_db_mount_name (const lfDatabase *db, const char *mount);
2158 
2160 LF_EXPORT const lfMount *const *lf_db_get_mounts (lfDatabase *db);
2161 
2164 /*----------------------------------------------------------------------------*/
2165 
2174 enum
2175 {
2177  LF_MODIFY_TCA = 0x00000001,
2179  LF_MODIFY_VIGNETTING = 0x00000002,
2180  /* Value 0x00000004 is deprecated. */
2182  LF_MODIFY_DISTORTION = 0x00000008,
2184  LF_MODIFY_GEOMETRY = 0x00000010,
2186  LF_MODIFY_SCALE = 0x00000020,
2191 };
2192 
2195 {
2206 };
2207 
2208 C_TYPEDEF (enum, lfPixelFormat)
2209 
2210 
2214 {
2237 };
2238 
2239 C_TYPEDEF (enum, lfComponentRole)
2240 
2241 
2242 #define LF_CR_1(a) (LF_CR_ ## a)
2243 
2244 #define LF_CR_2(a,b) ((LF_CR_ ## a) | ((LF_CR_ ## b) << 4))
2245 
2246 #define LF_CR_3(a,b,c) ((LF_CR_ ## a) | ((LF_CR_ ## b) << 4) | \
2247  ((LF_CR_ ## c) << 8))
2248 
2249 #define LF_CR_4(a,b,c,d) ((LF_CR_ ## a) | ((LF_CR_ ## b) << 4) | \
2250  ((LF_CR_ ## c) << 8) | ((LF_CR_ ## d) << 12))
2251 
2252 #define LF_CR_5(a,b,c,d,e) ((LF_CR_ ## a) | ((LF_CR_ ## b) << 4) | \
2253  ((LF_CR_ ## c) << 8) | ((LF_CR_ ## d) << 12) | \
2254  ((LF_CR_ ## e) << 16))
2255 
2256 #define LF_CR_6(a,b,c,d,e,f) ((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 
2260 #define LF_CR_7(a,b,c,d,e,f,g) ((LF_CR_ ## a) | ((LF_CR_ ## b) << 4) | \
2261  ((LF_CR_ ## c) << 8) | ((LF_CR_ ## d) << 12) | \
2262  ((LF_CR_ ## e) << 16) | ((LF_CR_ ## f) << 20) | \
2263  ((LF_CR_ ## g) << 24))
2264 
2265 #define LF_CR_8(a,b,c,d,e,f,g,h) ((LF_CR_ ## a) | ((LF_CR_ ## b) << 4) | \
2266  ((LF_CR_ ## c) << 8) | ((LF_CR_ ## d) << 12) | \
2267  ((LF_CR_ ## e) << 16) | ((LF_CR_ ## f) << 20) | \
2268  ((LF_CR_ ## g) << 24) | ((LF_CR_ ## h) << 28))
2269 
2270 // @cond
2271 
2272 
2273 
2274 // @endcond
2275 
2350 #ifdef __cplusplus
2351 }
2352 #endif
2353 
2355 {
2356 #ifdef __cplusplus
2357 
2378  DEPRECATED lfModifier (const lfLens *lens, float crop, int width, int height);
2379 
2406  DEPRECATED static lfModifier *Create (const lfLens *lens, float crop, int width, int height);
2407 
2453  DEPRECATED int Initialize (
2454  const lfLens *lens, lfPixelFormat format, float focal, float aperture,
2455  float distance, float scale, lfLensType targeom, int flags, bool reverse);
2456 
2463  DEPRECATED void Destroy ();
2464 
2492  lfModifier (const lfLens *lens, float imgfocal, float imgcrop, int imgwidth, int imgheight, lfPixelFormat pixel_format, bool reverse = false);
2493 
2495  ~lfModifier ();
2496 
2505  int EnableDistortionCorrection (const lfLensCalibDistortion& lcd);
2516  int EnableDistortionCorrection ();
2517 
2526  int EnableTCACorrection (const lfLensCalibTCA& lctca);
2537  int EnableTCACorrection ();
2538 
2547  int EnableVignettingCorrection (const lfLensCalibVignetting& lcv);
2562  int EnableVignettingCorrection (float aperture, float distance);
2563 
2576  int EnableProjectionTransform (lfLensType target_projection);
2577 
2586  int EnableScaling (float scale);
2587 
2642  int EnablePerspectiveCorrection (float *x, float *y, int count, float d);
2643 
2647  int GetModFlags ();
2648 
2662  float GetAutoScale (bool reverse);
2663 
2693  bool ApplyColorModification (void *pixels, float x, float y, int width, int height,
2694  int comp_role, int row_stride) const;
2695 
2726  bool ApplyGeometryDistortion (float xu, float yu, int width, int height,
2727  float *res) const;
2728 
2760  bool ApplySubpixelDistortion (float xu, float yu, int width, int height,
2761  float *res) const;
2762 
2793  bool ApplySubpixelGeometryDistortion (float xu, float yu, int width, int height,
2794  float *res) const;
2795 
2796 private:
2797 
2799  struct lfCallbackData
2800  {
2801  virtual ~lfCallbackData() {}
2802  int priority;
2803 
2804  bool operator<(const lfCallbackData& c) const { return priority < c.priority; }
2805  bool operator>(const lfCallbackData& c) const { return priority > c.priority; }
2806  };
2807 
2810  struct lfCallBackDataPtrComp
2811  {
2812  bool operator () (const lfCallbackData* lhs, const lfCallbackData* rhs) const {
2813  return lhs->priority < rhs->priority;
2814  }
2815  };
2816 
2832  typedef void (*lfModifySubpixCoordFunc) (void *data, float *iocoord, int count);
2833 
2858  typedef void (*lfModifyColorFunc) (void *data, float x, float y,
2859  void *pixels, int comp_role, int count);
2860 
2873  typedef void (*lfModifyCoordFunc) (void *data, float *iocoord, int count);
2874 
2876  struct lfSubpixelCallback : public lfCallbackData
2877  {
2878  lfModifySubpixCoordFunc callback;
2879  };
2880 
2881  struct lfSubpixTCACallback : public lfSubpixelCallback
2882  {
2883  float terms [12];
2884  };
2885 
2887  struct lfCoordCallback : public lfCallbackData
2888  {
2889  lfModifyCoordFunc callback;
2890  };
2891 
2892  struct lfCoordDistCallbackData : public lfCoordCallback
2893  {
2894  float terms [5];
2895  };
2896 
2897  struct lfCoordScaleCallbackData : public lfCoordCallback
2898  {
2899  float scale_factor;
2900  };
2901 
2902  struct lfCoordGeomCallbackData : public lfCoordCallback
2903  {
2904  };
2905 
2906  struct lfCoordPerspCallbackData : public lfCoordCallback
2907  {
2908  float A [3][3];
2909  float delta_a, delta_b;
2910  };
2911 
2913  struct lfColorCallback : public lfCallbackData
2914  {
2915  lfModifyColorFunc callback;
2916  };
2917 
2918  struct lfColorVignCallbackData : public lfColorCallback
2919  {
2920  float norm_scale;
2921  float terms [3];
2922  };
2923 
2925  std::multiset<lfSubpixelCallback*, lfCallBackDataPtrComp> SubpixelCallbacks;
2927  std::multiset<lfColorCallback*, lfCallBackDataPtrComp> ColorCallbacks;
2929  std::multiset<lfCoordCallback*, lfCallBackDataPtrComp> CoordCallbacks;
2930 
2931  // A test point in the autoscale algorithm
2932  typedef struct { float angle, dist; } lfPoint;
2933 
2934  void AddSubpixTCACallback (const lfLensCalibTCA& lcd, lfModifySubpixCoordFunc func, int priority);
2935  void AddCoordGeomCallback (lfModifyCoordFunc func, int priority);
2936  void AddCoordDistCallback (const lfLensCalibDistortion& lcd, lfModifyCoordFunc func, int priority);
2937  void AddColorVignCallback (const lfLensCalibVignetting& lcv, lfModifyColorFunc func, int priority);
2938 
2952  double AutoscaleResidualDistance (float *coord) const;
2967  float GetTransformedDistance (lfPoint point) const;
2968 
2969  static void ModifyCoord_TCA_Linear (void *data, float *iocoord, int count);
2970  static void ModifyCoord_UnTCA_Poly3 (void *data, float *iocoord, int count);
2971  static void ModifyCoord_TCA_Poly3 (void *data, float *iocoord, int count);
2972  static void ModifyCoord_TCA_ACM (void *data, float *iocoord, int count);
2973 
2974  static void ModifyCoord_UnDist_Poly3 (void *data, float *iocoord, int count);
2975  static void ModifyCoord_Dist_Poly3 (void *data, float *iocoord, int count);
2976 #ifdef VECTORIZATION_SSE
2977  static void ModifyCoord_Dist_Poly3_SSE (void *data, float *iocoord, int count);
2978 #endif
2979  static void ModifyCoord_UnDist_Poly5 (void *data, float *iocoord, int count);
2980  static void ModifyCoord_Dist_Poly5 (void *data, float *iocoord, int count);
2981  static void ModifyCoord_UnDist_PTLens (void *data, float *iocoord, int count);
2982  static void ModifyCoord_Dist_PTLens (void *data, float *iocoord, int count);
2983 #ifdef VECTORIZATION_SSE
2984  static void ModifyCoord_UnDist_PTLens_SSE (void *data, float *iocoord, int count);
2985  static void ModifyCoord_Dist_PTLens_SSE (void *data, float *iocoord, int count);
2986 #endif
2987  static void ModifyCoord_Dist_ACM (void *data, float *iocoord, int count);
2988  static void ModifyCoord_Geom_FishEye_Rect (void *data, float *iocoord, int count);
2989  static void ModifyCoord_Geom_Panoramic_Rect (void *data, float *iocoord, int count);
2990  static void ModifyCoord_Geom_ERect_Rect (void *data, float *iocoord, int count);
2991  static void ModifyCoord_Geom_Rect_FishEye (void *data, float *iocoord, int count);
2992  static void ModifyCoord_Geom_Panoramic_FishEye (void *data, float *iocoord, int count);
2993  static void ModifyCoord_Geom_ERect_FishEye (void *data, float *iocoord, int count);
2994  static void ModifyCoord_Geom_Rect_Panoramic (void *data, float *iocoord, int count);
2995  static void ModifyCoord_Geom_FishEye_Panoramic (void *data, float *iocoord, int count);
2996  static void ModifyCoord_Geom_ERect_Panoramic (void *data, float *iocoord, int count);
2997  static void ModifyCoord_Geom_Rect_ERect (void *data, float *iocoord, int count);
2998  static void ModifyCoord_Geom_FishEye_ERect (void *data, float *iocoord, int count);
2999  static void ModifyCoord_Geom_Panoramic_ERect (void *data, float *iocoord, int count);
3000  static void ModifyCoord_Geom_Orthographic_ERect (void *data, float *iocoord, int count);
3001  static void ModifyCoord_Geom_ERect_Orthographic (void *data, float *iocoord, int count);
3002  static void ModifyCoord_Geom_Stereographic_ERect (void *data, float *iocoord, int count);
3003  static void ModifyCoord_Geom_ERect_Stereographic (void *data, float *iocoord, int count);
3004  static void ModifyCoord_Geom_Equisolid_ERect (void *data, float *iocoord, int count);
3005  static void ModifyCoord_Geom_ERect_Equisolid (void *data, float *iocoord, int count);
3006  static void ModifyCoord_Geom_Thoby_ERect (void *data, float *iocoord, int count);
3007  static void ModifyCoord_Geom_ERect_Thoby (void *data, float *iocoord, int count);
3008  static void ModifyCoord_Perspective_Correction (void *data, float *iocoord, int count);
3009  static void ModifyCoord_Perspective_Distortion (void *data, float *iocoord, int count);
3010 #ifdef VECTORIZATION_SSE
3011  static void ModifyColor_DeVignetting_PA_SSE (
3012  void *data, float _x, float _y, lf_f32 *pixels, int comp_role, int count);
3013 #endif
3014 #ifdef VECTORIZATION_SSE2
3015  static void ModifyColor_DeVignetting_PA_SSE2 (
3016  void *data, float _x, float _y, lf_u16 *pixels, int comp_role, int count);
3017 #endif
3018 
3019  template<typename T> static void ModifyColor_Vignetting_PA (
3020  void *data, float x, float y, T *rgb, int comp_role, int count);
3021  template<typename T> static void ModifyColor_DeVignetting_PA (
3022  void *data, float x, float y, T *rgb, int comp_role, int count);
3023 
3024  static void ModifyCoord_Scale (void *data, float *iocoord, int count);
3025 #endif
3026  double Width, Height;
3030  double Crop;
3032  double Focal;
3035  double RealFocal;
3037  double CenterX, CenterY;
3039  double NormScale, NormUnScale;
3040 
3042  cbool Reverse;
3043 
3045  lfPixelFormat PixelFormat;
3046 
3047  const lfLens* Lens;
3048 
3050  int EnabledMods;
3051 };
3052 
3053 #ifdef __cplusplus
3054 extern "C" {
3055 #endif
3056 
3057 C_TYPEDEF (struct, lfModifier)
3058 
3059 
3061  const lfLens *lens, float crop, int width, int height);
3062 
3065  const lfLens* lens, float imgfocal, float imgcrop, int imgwidth, int imgheight, lfPixelFormat pixel_format, bool reverse);
3066 
3068 LF_EXPORT void lf_modifier_destroy (lfModifier *modifier);
3069 
3072  lfModifier *modifier, const lfLens *lens, lfPixelFormat format,
3073  float focal, float aperture, float distance, float scale,
3074  lfLensType targeom, int flags, cbool reverse);
3075 
3077 LF_EXPORT int lf_modifier_enable_scaling (lfModifier *modifier, float scale);
3078 
3081 
3084 
3087  lfModifier *modifier, float aperture, float distance);
3088 
3091  lfModifier *modifier, lfLensType target_projection);
3092 
3095  lfModifier *modifier, float *x, float *y, int count, float d);
3096 
3099 
3102  lfModifier *modifier, cbool reverse);
3103 
3106  lfModifier *modifier, float xu, float yu, int width, int height, float *res);
3107 
3110  lfModifier *modifier, void *pixels, float x, float y, int width, int height,
3111  int comp_role, int row_stride);
3112 
3115  lfModifier *modifier, float xu, float yu, int width, int height, float *res);
3116 
3119  lfModifier *modifier, float xu, float yu, int width, int height, float *res);
3120 
3123 #undef cbool
3124 
3125 #ifdef __cplusplus
3126 }
3127 #endif
3128 
3129 #endif /* __LENSFUN_H__ */
const lfLens *const * lf_db_get_lenses(lfDatabase *db)
Panoramic (cylindrical)
Definition: lensfun.h:999
lfDistortionModel
The Lensfun library implements several lens distortion models. This enum lists them.
Definition: lensfun.h:549
float MinAperture
Definition: lensfun.h:1043
const lfCamera *const * lf_db_get_cameras(lfDatabase *db)
Definition: lensfun.h:2199
Definition: lensfun.h:2228
cbool lf_modifier_apply_subpixel_geometry_distortion(lfModifier *modifier, float xu, float yu, int width, int height, float *res)
Adobe Camera Model. The coordinate system is different here. Everything is measured in units of the f...
Definition: lensfun.h:594
unsigned int lf_u32
Definition: lensfun.h:145
static const char *const UserUpdatesLocation
Home lens database directory for automatic updates (something like "~/.local/share/lensfun/updates") ...
Definition: lensfun.h:1729
void lf_lens_add_calib_tca(lfLens *lens, const lfLensCalibTCA *tcac)
const lfCamera ** lf_db_find_cameras(const lfDatabase *db, const char *maker, const char *model)
DEPRECATED void lf_lens_add_calib_fov(lfLens *lens, const lfLensCalibFov *cf)
lfMLstr Maker
Definition: lensfun.h:1035
const char *const lf_db_system_location
void lf_lens_remove_calibrations(lfLens *lens)
float FieldOfView
Field of view for given images.
Definition: lensfun.h:876
Rectilinear lens.
Definition: lensfun.h:986
lfLens * lf_lens_create()
Create a new lens object.
Definition: lensfun.h:2182
lfLensType Type
Definition: lensfun.h:1049
lfLensCalibAttributes CalibAttr
Pointer to the calibration settings (currently unused).
Definition: lensfun.h:878
This flag makes Lensfun to sort the results by focal length, and remove all double lens names...
Definition: lensfun.h:1700
DEPRECATED char ** Mounts
Definition: lensfun.h:1047
no crop at all
Definition: lensfun.h:823
lfCamera * lf_camera_create()
Create a new camera object.
Definition: lensfun.h:2205
Definition: lensfun.h:2197
5th order polynomial model.
Definition: lensfun.h:569
lfError
Definition: lensfun.h:128
const char * lf_get_distortion_model_desc(enum lfDistortionModel model, const char **details, const lfParameter ***params)
void lf_lens_guess_parameters(lfLens *lens)
float CenterX
Definition: lensfun.h:1059
float Focal
Focal length in mm at which this calibration data was taken.
Definition: lensfun.h:804
Laterlal chromatic aberrations calibration data.
Definition: lensfun.h:733
DEPRECATED const lfLens ** lf_db_find_lenses_hd(const lfDatabase *db, const lfCamera *camera, const char *maker, const char *lens, int sflags)
long int lf_db_read_timestamp(const char *dirname)
DEPRECATED cbool lf_db_load_directory(lfDatabase *db, const char *dirname)
DEPRECATED cbool lf_lens_remove_calib_tca(lfLens *lens, int idx)
Definition: lensfun.h:135
Lens distortion calibration data.
Definition: lensfun.h:605
static const char *const SystemLocation
System lens database directory (something like "/usr/share/lensfun")
Definition: lensfun.h:1731
double lf_f64
Definition: lensfun.h:149
cbool lf_lens_interpolate_distortion(const lfLens *lens, float crop, float focal, lfLensCalibDistortion *res)
DEPRECATED lfModifier * lf_modifier_new(const lfLens *lens, float crop, int width, int height)
A set of calibration data.
Definition: lensfun.h:890
void lf_lens_copy(lfLens *dest, const lfLens *source)
Copy the data from one lfLens structure into another.
lfLensCalibAttributes CalibAttr
Pointer to the calibration settings (currently unused).
Definition: lensfun.h:851
void lf_mount_destroy(lfMount *mount)
Destroy a lfMount object.
Lens data. Unknown fields are set to NULL or 0.
Definition: lensfun.h:1032
DEPRECATED lfMount * lf_mount_new()
Create a new mount object.
int lf_modifier_enable_distortion_correction(lfModifier *modifier)
DEPRECATED lfLensCalibDistortion ** CalibDistortion
Definition: lensfun.h:1067
lfPixelFormat
A list of pixel formats supported by internal colour callbacks.
Definition: lensfun.h:2194
Definition: lensfun.h:2186
lfVignettingModel
The Lensfun library supports several models for lens vignetting correction.
Definition: lensfun.h:763
int lf_modifier_enable_perspective_correction(lfModifier *modifier, float *x, float *y, int count, float d)
float CenterY
Definition: lensfun.h:1061
Adobe camera model for TCA. The coordinate system is different here. Everything is measured in units ...
Definition: lensfun.h:721
This structure contains everything specific to a camera mount.
Definition: lensfun.h:218
float MinFocal
Definition: lensfun.h:1039
const char * lf_db_mount_name(const lfDatabase *db, const char *mount)
const char *const lf_db_user_location
Stereographic fisheye.
Definition: lensfun.h:1010
int Score
Definition: lensfun.h:1077
Linear lateral chromatic aberrations model.
Definition: lensfun.h:681
Third order polynomial.
Definition: lensfun.h:693
Definition: lensfun.h:2184
use a circular crop, e.g. for circular fisheye images
Definition: lensfun.h:827
#define cbool
C-compatible bool type; don&#39;t bother to define Yet Another Boolean Type.
Definition: lensfun.h:115
DEPRECATED float CropFactor
Definition: lensfun.h:1063
lfMLstr Model
Definition: lensfun.h:1037
float Focal
Focal length in mm at which this calibration data was taken.
Definition: lensfun.h:838
cbool lf_modifier_apply_subpixel_distortion(lfModifier *modifier, float xu, float yu, int width, int height, float *res)
int Score
Camera matching score, used while searching: not actually a camera parameter.
Definition: lensfun.h:378
DEPRECATED char * UserUpdatesDir
Home lens database directory for automatic updates (deprecated). Replaced by lfDatabase::UserUpdatesL...
Definition: lensfun.h:1721
void lf_free(void *data)
const char *const lf_db_system_updates_location
cbool lf_mount_check(lfMount *mount)
float lf_modifier_get_auto_scale(lfModifier *modifier, cbool reverse)
Orthographic fisheye.
Definition: lensfun.h:1008
lfLensType
Lens type. See Change of projection for further information.
Definition: lensfun.h:978
DEPRECATED char ** Compat
Definition: lensfun.h:227
DEPRECATED cbool lf_lens_remove_calib_vignetting(lfLens *lens, int idx)
Definition: lensfun.h:2179
cbool lf_lens_interpolate_crop(const lfLens *lens, float crop, float focal, lfLensCalibCrop *res)
int lf_lens_available_modifications(lfLens *lens, float crop)
DEPRECATED lfLensCalibFov ** CalibFov
Definition: lensfun.h:1075
PTLens model, which is also used by Hugin.
Definition: lensfun.h:577
const char *const * lf_mount_get_compats(lfMount *mount)
Definition: lensfun.h:2230
3rd order polynomial model, which is a subset of the PTLens model.
Definition: lensfun.h:560
use a rectangular crop
Definition: lensfun.h:825
lfError lf_db_load_path(lfDatabase *db, const char *pathname)
float CropFactor
Definition: lensfun.h:521
const char * lf_get_tca_model_desc(enum lfTCAModel model, const char **details, const lfParameter ***params)
const lfMount * lf_db_find_mount(const lfDatabase *db, const char *mount)
lfLensCalibAttributes Attributes
Definition: lensfun.h:893
#define C_TYPEDEF(t, c)
Definition: lensfun.h:45
Equisolid fisheye.
Definition: lensfun.h:1012
Fisheye as measured by Thoby (for Nikkor 10.5).
Definition: lensfun.h:1018
float Focal
Focal length in mm at which this calibration data was taken.
Definition: lensfun.h:738
Definition: lensfun.h:2232
unsigned char lf_u8
Definition: lensfun.h:141
DEPRECATED lfLensCalibTCA ** CalibTCA
Definition: lensfun.h:1069
Definition: lensfun.h:2234
lfLensCalibAttributes CalibAttr
Pointer to the calibration settings (currently unused).
Definition: lensfun.h:812
const lfLens ** lf_db_find_lenses(const lfDatabase *db, const lfCamera *camera, const char *maker, const char *lens, int sflags)
#define LF_EXPORT
This macro expands to an appropiate symbol visibility declaration.
Definition: lensfun.h:81
DEPRECATED lfLens * lf_lens_new()
Create a new lens object.
void lf_camera_destroy(lfCamera *camera)
Destroy a lfCamera object.
DEPRECATED cbool lf_lens_remove_calib_distortion(lfLens *lens, int idx)
lfLensCalibAttributes CalibAttr
Pointer to the calibration settings (currently unused).
Definition: lensfun.h:742
float Min
Minimal value that has sense.
Definition: lensfun.h:966
float Max
Maximal value that has sense.
Definition: lensfun.h:968
Unknown lens type.
Definition: lensfun.h:981
cbool RealFocalMeasured
Whether the real focal length was actually measured.
Definition: lensfun.h:644
cbool lf_modifier_apply_color_modification(lfModifier *modifier, void *pixels, float x, float y, int width, int height, int comp_role, int row_stride)
const lfCamera ** lf_db_find_cameras_ext(const lfDatabase *db, const char *maker, const char *model, int sflags)
float RealFocal
Real focal length in mm for this nominal focal length.
Definition: lensfun.h:641
A modifier object contains optimized data required to rectify a image.
Definition: lensfun.h:2354
cbool lf_camera_check(lfCamera *camera)
Definition: lensfun.h:2219
float CropFactor
Camera crop factor (ex: 1.0). Must be defined.
Definition: lensfun.h:376
const char * lf_mlstr_get(const lfMLstr str)
Get a string corresponding to current locale from a multi-language string.
void lf_camera_copy(lfCamera *dest, const lfCamera *source)
Copy the data from one lfCamera structure into another.
Definition: lensfun.h:133
DEPRECATED float AspectRatio
Definition: lensfun.h:1065
This flag selects a looser search algorithm resulting in more results (still sorted by score)...
Definition: lensfun.h:1688
float Distance
Focus distance in meters.
Definition: lensfun.h:808
void lf_lens_add_calib_distortion(lfLens *lens, const lfLensCalibDistortion *dc)
void lf_modifier_destroy(lfModifier *modifier)
DEPRECATED lfLensCalibVignetting ** CalibVignetting
Definition: lensfun.h:1071
float Aperture
Aperture (f-number) at which this calibration data was taken.
Definition: lensfun.h:806
#define DEPRECATED
For marking deprecated functions, see http://stackoverflow.com/a/21265197.
Definition: lensfun.h:108
static const char *const SystemUpdatesLocation
System lens database directory for automatic updates (something like "/var/lib/lensfun-updates") ...
Definition: lensfun.h:1734
Definition: lensfun.h:2236
cbool lf_modifier_apply_geometry_distortion(lfModifier *modifier, float xu, float yu, int width, int height, float *res)
cbool lf_lens_interpolate_tca(const lfLens *lens, float crop, float focal, lfLensCalibTCA *res)
float MaxFocal
Definition: lensfun.h:1041
DEPRECATED lfError lf_db_load_data(lfDatabase *db, const char *errcontext, const char *data, size_t data_size)
Definition: lensfun.h:2177
void lf_mount_copy(lfMount *dest, const lfMount *source)
Copy the data from one lfMount structure into another.
int lf_modifier_get_mod_flags(lfModifier *modifier)
lfError lf_db_load_str(lfDatabase *db, const char *xml, size_t data_size)
const char *const * lf_lens_get_mount_names(const lfLens *lens)
int lf_modifier_enable_tca_correction(lfModifier *modifier)
unsigned short lf_u16
Definition: lensfun.h:143
lfComponentRole
These constants define the role of every pixel component, four bits each. "pixel" refers here to a se...
Definition: lensfun.h:2213
const char * lf_get_lens_type_desc(enum lfLensType type, const char **details)
Equirectangular.
Definition: lensfun.h:1006
Definition: lensfun.h:2226
DEPRECATED cbool lf_lens_remove_calib_crop(lfLens *lens, int idx)
void lf_mount_add_compat(lfMount *mount, const char *val)
float Focal
Nominal focal length in mm at which this calibration data was taken.
Definition: lensfun.h:611
int lf_modifier_enable_scaling(lfModifier *modifier, float scale)
const char *const lf_db_user_updates_location
float Focal
Definition: lensfun.h:866
lfError lf_db_save_str(const lfDatabase *db, char **xml, size_t *data_size)
cbool lf_lens_interpolate_vignetting(const lfLens *lens, float crop, float focal, float aperture, float distance, lfLensCalibVignetting *res)
lfLensCalibAttributes CalibAttr
Calibration settings (currently unused).
Definition: lensfun.h:648
void lf_lens_destroy(lfLens *lens)
Destroy a lfLens object.
DEPRECATED cbool lf_lens_interpolate_fov(const lfLens *lens, float crop, float focal, lfLensCalibFov *res)
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)
Definition: lensfun.h:2190
void lf_db_destroy(lfDatabase *db)
Destroy the database object.
DEPRECATED lfCamera * lf_camera_new()
Create a new camera object.
Equidistant fisheye.
Definition: lensfun.h:992
cbool lf_modifier_enable_projection_transform(lfModifier *modifier, lfLensType target_projection)
Definition: lensfun.h:2201
No TCA correction data is known.
Definition: lensfun.h:669
lfMLstr Model
Model name (ex: "Rolleiflex SL35") – same as in EXIF.
Definition: lensfun.h:370
const char * lf_get_crop_desc(enum lfCropMode mode, const char **details, const lfParameter ***params)
DEPRECATED lfLensCalibCrop ** CalibCrop
Definition: lensfun.h:1073
lfMLstr Maker
Camera maker (ex: "Rollei") – same as in EXIF.
Definition: lensfun.h:368
DEPRECATED cbool lf_lens_remove_calib_fov(lfLens *lens, int idx)
Definition: lensfun.h:131
void lf_lens_add_mount(lfLens *lens, const char *val)
cbool lf_lens_check(lfLens *lens)
float AspectRatio
Definition: lensfun.h:523
DEPRECATED char * HomeDataDir
Home lens database directory (deprecated). Replaced by lfDatabase::UserLocation.
Definition: lensfun.h:1719
const char * lf_get_vignetting_model_desc(enum lfVignettingModel model, const char **details, const lfParameter ***params)
char * Mount
Camera mount type (ex: "QBM")
Definition: lensfun.h:374
char * lfMLstr
Definition: lensfun.h:125
A lens database object.
Definition: lensfun.h:1716
DEPRECATED lfDatabase * lf_db_new(void)
Create a new empty database object.
void lf_lens_add_calib_crop(lfLens *lens, const lfLensCalibCrop *cc)
const lfMount *const * lf_db_get_mounts(lfDatabase *db)
Pablo D&#39;Angelo vignetting model (which is a more general variant of the law).
Definition: lensfun.h:776
Distortion parameters are unknown.
Definition: lensfun.h:552
lfMLstr Name
Camera mount name.
Definition: lensfun.h:225
lfDatabase * lf_db_create(void)
Create a new empty database object.
int lf_modifier_enable_vignetting_correction(lfModifier *modifier, float aperture, float distance)
Lens vignetting calibration data.
Definition: lensfun.h:799
float lf_f32
Definition: lensfun.h:147
static const char *const UserLocation
Home lens database directory (something like "~/.local/share/lensfun")
Definition: lensfun.h:1726
lfMLstr lf_mlstr_add(lfMLstr str, const char *lang, const char *trstr)
Add a new translated string to a multi-language string.
No vignetting correction data is known.
Definition: lensfun.h:766
DEPRECATED lfError lf_db_load_file(lfDatabase *db, const char *filename)
void lf_lens_add_calib_vignetting(lfLens *lens, const lfLensCalibVignetting *vc)
Definition: lensfun.h:2188
lfError lf_db_save_all(const lfDatabase *db, const char *filename)
lfTCAModel
The Lensfun library supports several models for lens lateral chromatic aberrations (also called trans...
Definition: lensfun.h:666
float Default
Default value for the parameter.
Definition: lensfun.h:970
Adobe&#39;s vignetting model. It differs from D&#39;Angelo&#39;s model only in the coordinate system...
Definition: lensfun.h:787
lfCropMode
Different crop modes.
Definition: lensfun.h:820
Struct to save calibrated field of view, which can depends on the focal length (DEPRECATED) ...
Definition: lensfun.h:863
Lens calibration attributes.
Definition: lensfun.h:518
Camera data. Unknown fields are set to NULL.
Definition: lensfun.h:365
lfMLstr lf_mlstr_dup(const lfMLstr str)
Create a complete copy of a multi-language string.
lfMount * lf_mount_create()
Create a new mount object.
lfMLstr Variant
Camera variant. Some cameras use same EXIF id for different models.
Definition: lensfun.h:372
Struct to save image crop, which can depend on the focal length.
Definition: lensfun.h:835
Definition: lensfun.h:2203
const char * Name
Parameter name (something like &#39;k&#39;, &#39;k3&#39;, &#39;omega&#39; etc.)
Definition: lensfun.h:964
This structure describes a single parameter for some lens model.
Definition: lensfun.h:961
lfError lf_db_load(lfDatabase *db)
lfModifier * lf_modifier_create(const lfLens *lens, float imgfocal, float imgcrop, int imgwidth, int imgheight, lfPixelFormat pixel_format, bool reverse)
float MaxAperture
Definition: lensfun.h:1045