lensfun  0.3.99.0
Classes | Macros | Typedefs | Enumerations | Functions | Variables
lensfun.h File Reference
#include <stddef.h>
#include <string>
#include <vector>
#include <set>

Go to the source code of this file.

Classes

struct  lfMount
 This structure contains everything specific to a camera mount. More...
 
struct  lfCamera
 Camera data. Unknown fields are set to NULL. More...
 
struct  lfLensCalibAttributes
 Lens calibration attributes. More...
 
struct  lfLensCalibDistortion
 Lens distortion calibration data. More...
 
struct  lfLensCalibTCA
 Laterlal chromatic aberrations calibration data. More...
 
struct  lfLensCalibVignetting
 Lens vignetting calibration data. More...
 
struct  lfLensCalibCrop
 Struct to save image crop, which can depend on the focal length. More...
 
struct  lfLensCalibFov
 Struct to save calibrated field of view, which can depends on the focal length (DEPRECATED) More...
 
struct  lfLensCalibrationSet
 A set of calibration data. More...
 
struct  lfParameter
 This structure describes a single parameter for some lens model. More...
 
struct  lfLens
 Lens data. Unknown fields are set to NULL or 0. More...
 
struct  lfDatabase
 A lens database object. More...
 
struct  lfModifier
 A modifier object contains optimized data required to rectify a image. More...
 

Macros

#define C_TYPEDEF(t, c)
 
#define LF_VERSION_MAJOR   0
 Major library version number.
 
#define LF_VERSION_MINOR   3
 Minor library version number.
 
#define LF_VERSION_MICRO   99
 Library micro version number.
 
#define LF_VERSION_BUGFIX   0
 Library bugfix number.
 
#define LF_VERSION   ((LF_VERSION_MAJOR << 24) | (LF_VERSION_MINOR << 16) | (LF_VERSION_MICRO << 8) | LF_VERSION_BUGFIX)
 Full library version.
 
#define LF_MIN_DATABASE_VERSION   0
 Oldest database version supported by this release.
 
#define LF_MAX_DATABASE_VERSION   2
 Latest database version supported by this release.
 
#define LF_EXPORT
 This macro expands to an appropriate symbol visibility declaration.
 
#define DEPRECATED
 For marking deprecated functions, see http://stackoverflow.com/a/21265197.
 
#define cbool   int
 C-compatible bool type; don't bother to define Yet Another Boolean Type.
 
#define LF_CR_1(a)   (LF_CR_ ## a)
 This macro defines a pixel format consisting of one component.
 
#define LF_CR_2(a, b)   ((LF_CR_ ## a) | ((LF_CR_ ## b) << 4))
 This macro defines a pixel format consisting of two components.
 
#define LF_CR_3(a, b, c)
 This macro defines a pixel format consisting of three components. More...
 
#define LF_CR_4(a, b, c, d)
 This macro defines a pixel format consisting of four components. More...
 
#define LF_CR_5(a, b, c, d, e)
 This macro defines a pixel format consisting of five components. More...
 
#define LF_CR_6(a, b, c, d, e, f)
 This macro defines a pixel format consisting of six components. More...
 
#define LF_CR_7(a, b, c, d, e, f, g)
 This macro defines a pixel format consisting of seven components. More...
 
#define LF_CR_8(a, b, c, d, e, f, g, h)
 This macro defines a pixel format consisting of eight components. More...
 

Typedefs

typedef char * lfMLstr
 
typedef unsigned char lf_u8
 
typedef unsigned short lf_u16
 
typedef unsigned int lf_u32
 
typedef float lf_f32
 
typedef double lf_f64
 

Enumerations

enum  lfError { LF_NO_ERROR = 0 , LF_WRONG_FORMAT , LF_NO_DATABASE }
 
enum  lfDistortionModel {
  LF_DIST_MODEL_NONE , LF_DIST_MODEL_POLY3 , LF_DIST_MODEL_POLY5 , LF_DIST_MODEL_PTLENS ,
  LF_DIST_MODEL_ACM
}
 The Lensfun library implements several lens distortion models. This enum lists them. More...
 
enum  lfTCAModel { LF_TCA_MODEL_NONE , LF_TCA_MODEL_LINEAR , LF_TCA_MODEL_POLY3 , LF_TCA_MODEL_ACM }
 The Lensfun library supports several models for lens lateral chromatic aberrations (also called transversal chromatic aberrations, TCA). More...
 
enum  lfVignettingModel { LF_VIGNETTING_MODEL_NONE , LF_VIGNETTING_MODEL_PA , LF_VIGNETTING_MODEL_ACM }
 The Lensfun library supports several models for lens vignetting correction. More...
 
enum  lfCropMode { LF_NO_CROP , LF_CROP_RECTANGLE , LF_CROP_CIRCLE }
 Different crop modes. More...
 
enum  lfLensType {
  LF_UNKNOWN , LF_RECTILINEAR , LF_FISHEYE , LF_PANORAMIC ,
  LF_EQUIRECTANGULAR , LF_FISHEYE_ORTHOGRAPHIC , LF_FISHEYE_STEREOGRAPHIC , LF_FISHEYE_EQUISOLID ,
  LF_FISHEYE_THOBY
}
 Lens type. See Change of projection for further information. More...
 
enum  { LF_SEARCH_LOOSE = 1 , LF_SEARCH_SORT_AND_UNIQUIFY = 2 }
 Flags controlling the behavior of database searches. More...
 
enum  {
  LF_MODIFY_TCA = 0x00000001 , LF_MODIFY_VIGNETTING = 0x00000002 , LF_MODIFY_DISTORTION = 0x00000008 , LF_MODIFY_GEOMETRY = 0x00000010 ,
  LF_MODIFY_SCALE = 0x00000020 , LF_MODIFY_PERSPECTIVE = 0x00000040 , LF_MODIFY_ALL = ~0
}
 A list of bitmask flags used for ordering various image corrections. More...
 
enum  lfPixelFormat {
  LF_PF_U8 , LF_PF_U16 , LF_PF_U32 , LF_PF_F32 ,
  LF_PF_F64
}
 A list of pixel formats supported by internal colour callbacks. More...
 
enum  lfComponentRole {
  LF_CR_END = 0 , LF_CR_NEXT , LF_CR_UNKNOWN , LF_CR_INTENSITY ,
  LF_CR_RED , LF_CR_GREEN , LF_CR_BLUE
}
 These constants define the role of every pixel component, four bits each. "pixel" refers here to a set of values which share the same (x, y) coordinates. More...
 

Functions

void lf_free (void *data)
 
const char * lf_mlstr_get (const lfMLstr str)
 Get a string corresponding to current locale from a multi-language string. More...
 
lfMLstr lf_mlstr_add (lfMLstr str, const char *lang, const char *trstr)
 Add a new translated string to a multi-language string. More...
 
lfMLstr lf_mlstr_dup (const lfMLstr str)
 Create a complete copy of a multi-language string. More...
 
lfMountlf_mount_create ()
 Create a new mount object. More...
 
void lf_mount_destroy (lfMount *mount)
 Destroy a lfMount object. More...
 
void lf_mount_copy (lfMount *dest, const lfMount *source)
 Copy the data from one lfMount structure into another. More...
 
cbool lf_mount_check (lfMount *mount)
 
void lf_mount_add_compat (lfMount *mount, const char *val)
 
const char *const * lf_mount_get_compats (lfMount *mount)
 
lfCameralf_camera_create ()
 Create a new camera object. More...
 
void lf_camera_destroy (lfCamera *camera)
 Destroy a lfCamera object. More...
 
void lf_camera_copy (lfCamera *dest, const lfCamera *source)
 Copy the data from one lfCamera structure into another. More...
 
cbool lf_camera_check (lfCamera *camera)
 
lfLenslf_lens_create ()
 Create a new lens object. More...
 
void lf_lens_destroy (lfLens *lens)
 Destroy a lfLens object. More...
 
void lf_lens_copy (lfLens *dest, const lfLens *source)
 Copy the data from one lfLens structure into another. More...
 
cbool lf_lens_check (lfLens *lens)
 
void lf_lens_guess_parameters (lfLens *lens)
 
void lf_lens_add_mount (lfLens *lens, const char *val)
 
const char *const * lf_lens_get_mount_names (const lfLens *lens)
 
const char * lf_get_distortion_model_desc (enum lfDistortionModel model, const char **details, const lfParameter ***params)
 
const char * lf_get_tca_model_desc (enum lfTCAModel model, const char **details, const lfParameter ***params)
 
const char * lf_get_vignetting_model_desc (enum lfVignettingModel model, const char **details, const lfParameter ***params)
 
const char * lf_get_crop_desc (enum lfCropMode mode, const char **details, const lfParameter ***params)
 
const char * lf_get_lens_type_desc (enum lfLensType type, const char **details)
 
cbool lf_lens_interpolate_distortion (const lfLens *lens, float crop, float focal, lfLensCalibDistortion *res)
 
cbool lf_lens_interpolate_tca (const lfLens *lens, float crop, float focal, lfLensCalibTCA *res)
 
cbool lf_lens_interpolate_vignetting (const lfLens *lens, float crop, float focal, float aperture, float distance, lfLensCalibVignetting *res)
 
cbool lf_lens_interpolate_crop (const lfLens *lens, float crop, float focal, lfLensCalibCrop *res)
 
void lf_lens_add_calib_distortion (lfLens *lens, const lfLensCalibDistortion *dc)
 
void lf_lens_add_calib_tca (lfLens *lens, const lfLensCalibTCA *tcac)
 
void lf_lens_add_calib_vignetting (lfLens *lens, const lfLensCalibVignetting *vc)
 
void lf_lens_add_calib_crop (lfLens *lens, const lfLensCalibCrop *cc)
 
void lf_lens_remove_calibrations (lfLens *lens)
 
int lf_lens_available_modifications (lfLens *lens, float crop)
 
lfDatabaself_db_create (void)
 Create a new empty database object. More...
 
void lf_db_destroy (lfDatabase *db)
 Destroy the database object. More...
 
long int lf_db_read_timestamp (const char *dirname)
 
lfError lf_db_load (lfDatabase *db)
 
lfError lf_db_load_path (lfDatabase *db, const char *pathname)
 
lfError lf_db_load_str (lfDatabase *db, const char *xml, size_t data_size)
 
lfError lf_db_save_all (const lfDatabase *db, const char *filename)
 
lfError lf_db_save_str (const lfDatabase *db, char **xml, size_t *data_size)
 
const lfCamera ** lf_db_find_cameras (const lfDatabase *db, const char *maker, const char *model)
 
const lfCamera ** lf_db_find_cameras_ext (const lfDatabase *db, const char *maker, const char *model, int sflags)
 
const lfCamera *const * lf_db_get_cameras (lfDatabase *db)
 
const lfLens ** lf_db_find_lenses (const lfDatabase *db, const lfCamera *camera, const char *maker, const char *lens, int sflags)
 
const lfLens *const * lf_db_get_lenses (lfDatabase *db)
 
const lfMountlf_db_find_mount (const lfDatabase *db, const char *mount)
 
const char * lf_db_mount_name (const lfDatabase *db, const char *mount)
 
const lfMount *const * lf_db_get_mounts (lfDatabase *db)
 
lfModifierlf_modifier_create (const lfLens *lens, float imgfocal, float imgcrop, int imgwidth, int imgheight, lfPixelFormat pixel_format, bool reverse)
 
void lf_modifier_destroy (lfModifier *modifier)
 
int lf_modifier_enable_scaling (lfModifier *modifier, float scale)
 
int lf_modifier_enable_distortion_correction (lfModifier *modifier)
 
int lf_modifier_enable_tca_correction (lfModifier *modifier)
 
int lf_modifier_enable_vignetting_correction (lfModifier *modifier, float aperture, float distance)
 
cbool lf_modifier_enable_projection_transform (lfModifier *modifier, lfLensType target_projection)
 
int lf_modifier_enable_perspective_correction (lfModifier *modifier, float *x, float *y, int count, float d)
 
int lf_modifier_get_mod_flags (lfModifier *modifier)
 
float lf_modifier_get_auto_scale (lfModifier *modifier, cbool reverse)
 
cbool lf_modifier_apply_subpixel_distortion (lfModifier *modifier, float xu, float yu, int width, int height, float *res)
 
cbool lf_modifier_apply_color_modification (lfModifier *modifier, void *pixels, float x, float y, int width, int height, int comp_role, int row_stride)
 
cbool lf_modifier_apply_geometry_distortion (lfModifier *modifier, float xu, float yu, int width, int height, float *res)
 
cbool lf_modifier_apply_subpixel_geometry_distortion (lfModifier *modifier, float xu, float yu, int width, int height, float *res)
 

Variables

const char *const lf_db_system_location
 
const char *const lf_db_system_updates_location
 
const char *const lf_db_user_location
 
const char *const lf_db_user_updates_location
 

Detailed Description

This file defines the interface to the Lensfun library.

Macro Definition Documentation

◆ C_TYPEDEF

#define C_TYPEDEF (   t,
 
)

Helper macro to make C/C++ work similarly