lensfun  0.3.2.0
Classes | Macros | Typedefs | Enumerations | Functions
lensfun.h File Reference
#include <stddef.h>
#include <vector>

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  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  lfLensCalibRealFocal
 Struct to save real focal length, which can depends on the (nominal) focal length. 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   2
 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_MAX_DATABASE_VERSION   2
 Latest database version supported by this release.
 
#define LF_EXPORT
 This macro expands to an appropiate 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 std::vector< float > fvector
 
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
 
typedef void(* lfSubpixelCoordFunc )(void *data, float *iocoord, int count)
 A callback function which modifies the separate coordinates for all color components for every pixel in a strip. More...
 
typedef void(* lfModifyColorFunc )(void *data, float x, float y, void *pixels, int comp_role, int count)
 A callback function which modifies the colors of a strip of pixels. More...
 
typedef void(* lfModifyCoordFunc )(void *data, float *iocoord, int count)
 A callback function which modifies the coordinates of a strip of pixels. More...
 

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_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_new ()
 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)
 
lfCameralf_camera_new ()
 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_new ()
 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)
 
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 focal, lfLensCalibDistortion *res)
 
cbool lf_lens_interpolate_tca (const lfLens *lens, float focal, lfLensCalibTCA *res)
 
cbool lf_lens_interpolate_vignetting (const lfLens *lens, float focal, float aperture, float distance, lfLensCalibVignetting *res)
 
cbool lf_lens_interpolate_crop (const lfLens *lens, float focal, lfLensCalibCrop *res)
 
DEPRECATED cbool lf_lens_interpolate_fov (const lfLens *lens, float focal, lfLensCalibFov *res)
 
cbool lf_lens_interpolate_real_focal (const lfLens *lens, float focal, lfLensCalibRealFocal *res)
 
void lf_lens_add_calib_distortion (lfLens *lens, const lfLensCalibDistortion *dc)
 
cbool lf_lens_remove_calib_distortion (lfLens *lens, int idx)
 
void lf_lens_add_calib_tca (lfLens *lens, const lfLensCalibTCA *tcac)
 
cbool lf_lens_remove_calib_tca (lfLens *lens, int idx)
 
void lf_lens_add_calib_vignetting (lfLens *lens, const lfLensCalibVignetting *vc)
 
cbool lf_lens_remove_calib_vignetting (lfLens *lens, int idx)
 
void lf_lens_add_calib_crop (lfLens *lens, const lfLensCalibCrop *cc)
 
cbool lf_lens_remove_calib_crop (lfLens *lens, int idx)
 
DEPRECATED void lf_lens_add_calib_fov (lfLens *lens, const lfLensCalibFov *cf)
 
DEPRECATED cbool lf_lens_remove_calib_fov (lfLens *lens, int idx)
 
void lf_lens_add_calib_real_focal (lfLens *lens, const lfLensCalibRealFocal *cf)
 
cbool lf_lens_remove_calib_real_focal (lfLens *lens, int idx)
 
lfDatabaself_db_new (void)
 Create a new empty database object. More...
 
void lf_db_destroy (lfDatabase *db)
 Destroy the database object. More...
 
lfError lf_db_load (lfDatabase *db)
 
lfError lf_db_load_file (lfDatabase *db, const char *filename)
 
cbool lf_db_load_directory (lfDatabase *db, const char *dirname)
 
lfError lf_db_load_data (lfDatabase *db, const char *errcontext, const char *data, size_t data_size)
 
lfError lf_db_save_all (const lfDatabase *db, const char *filename)
 
lfError lf_db_save_file (const lfDatabase *db, const char *filename, const lfMount *const *mounts, const lfCamera *const *cameras, const lfLens *const *lenses)
 
char * lf_db_save (const lfMount *const *mounts, const lfCamera *const *cameras, const lfLens *const *lenses)
 
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 (const lfDatabase *db)
 
const lfLens ** lf_db_find_lenses_hd (const lfDatabase *db, const lfCamera *camera, const char *maker, const char *lens, int sflags)
 
const lfLens ** lf_db_find_lenses (const lfDatabase *db, const lfLens *lens, int sflags)
 
const lfLens *const * lf_db_get_lenses (const 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 (const lfDatabase *db)
 
lfModifierlf_modifier_new (const lfLens *lens, float crop, int width, int height)
 
void lf_modifier_destroy (lfModifier *modifier)
 
int lf_modifier_initialize (lfModifier *modifier, const lfLens *lens, lfPixelFormat format, float focal, float aperture, float distance, float scale, lfLensType targeom, int flags, cbool reverse)
 
cbool lf_modifier_enable_perspective_correction (lfModifier *modifier, float *x, float *y, int count, float d)
 
void lf_modifier_add_coord_callback (lfModifier *modifier, lfModifyCoordFunc callback, int priority, void *data, size_t data_size)
 
void lf_modifier_add_subpixel_callback (lfModifier *modifier, lfSubpixelCoordFunc callback, int priority, void *data, size_t data_size)
 
void lf_modifier_add_color_callback (lfModifier *modifier, lfModifyColorFunc callback, int priority, void *data, size_t data_size)
 
cbool lf_modifier_add_subpixel_callback_TCA (lfModifier *modifier, lfLensCalibTCA *model, cbool reverse)
 
cbool lf_modifier_add_color_callback_vignetting (lfModifier *modifier, lfLensCalibVignetting *model, lfPixelFormat format, cbool reverse)
 
cbool lf_modifier_add_coord_callback_distortion (lfModifier *modifier, lfLensCalibDistortion *model, cbool reverse)
 
cbool lf_modifier_add_coord_callback_geometry (lfModifier *modifier, lfLensType from, lfLensType to)
 
cbool lf_modifier_add_coord_callback_scale (lfModifier *modifier, float scale, cbool reverse)
 
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)
 

Detailed Description

This file defines the interface to the Lensfun library.

Macro Definition Documentation

#define C_TYPEDEF (   t,
 
)

Helper macro to make C/C++ work similarly

Typedef Documentation

typedef std::vector<float> fvector

Multi-purpose array of float values.