lensfun: Image correction

lensfun 0.3.95.0

Classes | Macros | Enumerations | Functions
Image correction

This group of functions will allow you to apply a image transform that will correct some lens defects. More...

## Classes
struct | lfModifier
| A modifier object contains optimized data required to rectify a image. More...

## Macros
#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...

## Enumerations
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
DEPRECATED lfModifier * | lf_modifier_new (const lfLens *lens, float crop, int width, int height)
lfModifier * | lf_modifier_create (float imgcrop, int imgwidth, int imgheight, lfPixelFormat pixel_format, bool reverse)
void | lf_modifier_destroy (lfModifier *modifier)
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)
int | lf_modifier_enable_scaling (lfModifier *modifier, float scale)
int | lf_modifier_enable_distortion_correction (lfModifier *modifier, const lfLens *lens, float focal)
int | lf_modifier_enable_tca_correction (lfModifier *modifier, const lfLens *lens, float focal)
int | lf_modifier_enable_vignetting_correction (lfModifier *modifier, const lfLens *lens, float focal, float aperture, float distance)
cbool | lf_modifier_enable_projection_transform (lfModifier *modifier, const lfLens *lens, float focal, lfLensType target_projection)
int | lf_modifier_enable_perspective_correction (lfModifier *modifier, const lfLens *lens, float focal, float *x, float *y, int count, float d)
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 group of functions will allow you to apply a image transform that will correct some lens defects.

## Macro Definition Documentation

## ◆ LF_CR_3

#define LF_CR_3 | ( |  | a,
|  |  | b,
|  |  | c
| ) |  |

Value:
((LF_CR_ ## a) | ((LF_CR_ ## b) << 4) | \
((LF_CR_ ## c) << 8))

This macro defines a pixel format consisting of three components.

## ◆ LF_CR_4

#define LF_CR_4 | ( |  | a,
|  |  | b,
|  |  | c,
|  |  | d
| ) |  |

Value:
((LF_CR_ ## a) | ((LF_CR_ ## b) << 4) | \
((LF_CR_ ## c) << 8) | ((LF_CR_ ## d) << 12))

This macro defines a pixel format consisting of four components.

Examples
  lenstool.cpp.

## ◆ LF_CR_5

#define LF_CR_5 | ( |  | a,
|  |  | b,
|  |  | c,
|  |  | d,
|  |  | e
| ) |  |

Value:
((LF_CR_ ## a) | ((LF_CR_ ## b) << 4) | \
((LF_CR_ ## c) << 8) | ((LF_CR_ ## d) << 12) | \
((LF_CR_ ## e) << 16))

This macro defines a pixel format consisting of five components.

## ◆ LF_CR_6

#define LF_CR_6 | ( |  | a,
|  |  | b,
|  |  | c,
|  |  | d,
|  |  | e,
|  |  | f
| ) |  |

Value:
((LF_CR_ ## a) | ((LF_CR_ ## b) << 4) | \
((LF_CR_ ## c) << 8) | ((LF_CR_ ## d) << 12) | \
((LF_CR_ ## e) << 16) | ((LF_CR_ ## f) << 20))

This macro defines a pixel format consisting of six components.

## ◆ LF_CR_7

#define LF_CR_7 | ( |  | a,
|  |  | b,
|  |  | c,
|  |  | d,
|  |  | e,
|  |  | f,
|  |  | g
| ) |  |

Value:
((LF_CR_ ## a) | ((LF_CR_ ## b) << 4) | \
((LF_CR_ ## c) << 8) | ((LF_CR_ ## d) << 12) | \
((LF_CR_ ## e) << 16) | ((LF_CR_ ## f) << 20) | \
((LF_CR_ ## g) << 24))

This macro defines a pixel format consisting of seven components.

## ◆ LF_CR_8

#define LF_CR_8 | ( |  | a,
|  |  | b,
|  |  | c,
|  |  | d,
|  |  | e,
|  |  | f,
|  |  | g,
|  |  | h
| ) |  |

Value:
((LF_CR_ ## a) | ((LF_CR_ ## b) << 4) | \
((LF_CR_ ## c) << 8) | ((LF_CR_ ## d) << 12) | \
((LF_CR_ ## e) << 16) | ((LF_CR_ ## f) << 20) | \
((LF_CR_ ## g) << 24) | ((LF_CR_ ## h) << 28))

This macro defines a pixel format consisting of eight components.

## Enumeration Type Documentation

## ◆ anonymous enum

anonymous enum

A list of bitmask flags used for ordering various image corrections.

Enumerator
LF_MODIFY_TCA | Correct (or apply) lens transversal chromatic aberrations
LF_MODIFY_VIGNETTING | Correct (or apply) lens vignetting
LF_MODIFY_DISTORTION | Correct (or apply) lens distortion
LF_MODIFY_GEOMETRY | Convert image geometry
LF_MODIFY_SCALE | Additional resize of image
LF_MODIFY_PERSPECTIVE | Perspective Correction
LF_MODIFY_ALL | Apply all possible corrections

## ◆ lfComponentRole

enum lfComponentRole

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.

Enumerator
LF_CR_END | This marks the end of the role list. It doesn't have to be specified explicitly, since LF_CR_X macros always pad the value with zeros
LF_CR_NEXT | This value tells that what follows applies to next pixel. This can be used to define Bayer images, e.g. use LF_CR_3(LF_CR_RED, LF_CR_NEXT, LF_CR_GREEN) for even rows and LF_CR_3(LF_CR_GREEN, LF_CR_NEXT, LF_CR_BLUE) for odd rows.
LF_CR_UNKNOWN | This component has an unknown/doesn't matter role
LF_CR_INTENSITY | This is the pixel intensity (grayscale)
LF_CR_RED | This is the Red pixel component
LF_CR_GREEN | This is the Green pixel component
LF_CR_BLUE | This is the Blue pixel component

## ◆ lfPixelFormat

enum lfPixelFormat

A list of pixel formats supported by internal colour callbacks.

Enumerator
LF_PF_U8 | Unsigned 8-bit R,G,B
LF_PF_U16 | Unsigned 16-bit R,G,B
LF_PF_U32 | Unsigned 32-bit R,G,B
LF_PF_F32 | 32-bit floating-point R,G,B
LF_PF_F64 | 64-bit floating-point R,G,B

## Function Documentation

## ◆ 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
| ) |  |

See also
  lfModifier::ApplyColorModification

## ◆ lf_modifier_apply_geometry_distortion()

cbool lf_modifier_apply_geometry_distortion | ( | lfModifier * | modifier,
|  | float | xu,
|  | float | yu,
|  | int | width,
|  | int | height,
|  | float * | res
| ) |  |

See also
  lfModifier::ApplyGeometryDistortion

## ◆ lf_modifier_apply_subpixel_distortion()

cbool lf_modifier_apply_subpixel_distortion | ( | lfModifier * | modifier,
|  | float | xu,
|  | float | yu,
|  | int | width,
|  | int | height,
|  | float * | res
| ) |  |

See also
  lfModifier::ApplySubpixelDistortion

## ◆ 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
| ) |  |

See also
  lfModifier::ApplySubpixelGeometryDistortion

## ◆ lf_modifier_create()

lfModifier * lf_modifier_create | ( | float | imgcrop,
|  | int | imgwidth,
|  | int | imgheight,
|  | lfPixelFormat | pixel_format,
|  | bool | reverse
| ) |  |

See also
  lfModifier::lfModifier

## ◆ lf_modifier_destroy()

void lf_modifier_destroy | ( | lfModifier * | modifier | ) |

See also
  lfModifier::~lfModifier

## ◆ lf_modifier_enable_distortion_correction()

int lf_modifier_enable_distortion_correction | ( | lfModifier * | modifier,
|  | const lfLens * | lens,
|  | float | focal
| ) |  |

See also
  lfModifier::EnableDistortionCorrection

## ◆ 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
| ) |  |

See also
  lfModifier::EnablePerspectiveCorrection

## ◆ lf_modifier_enable_projection_transform()

cbool lf_modifier_enable_projection_transform | ( | lfModifier * | modifier,
|  | const lfLens * | lens,
|  | float | focal,
|  | lfLensType | target_projection
| ) |  |

See also
  lfModifier::EnableProjectionTransform

## ◆ lf_modifier_enable_scaling()

int lf_modifier_enable_scaling | ( | lfModifier * | modifier,
|  | float | scale
| ) |  |

See also
  lfModifier::EnableScaling

## ◆ lf_modifier_enable_tca_correction()

int lf_modifier_enable_tca_correction | ( | lfModifier * | modifier,
|  | const lfLens * | lens,
|  | float | focal
| ) |  |

See also
  lfModifier::EnableTCACorrection

## ◆ lf_modifier_enable_vignetting_correction()

int lf_modifier_enable_vignetting_correction | ( | lfModifier * | modifier,
|  | const lfLens * | lens,
|  | float | focal,
|  | float | aperture,
|  | float | distance
| ) |  |

See also
  lfModifier::EnableVignettingCorrection

## ◆ lf_modifier_get_auto_scale()

float lf_modifier_get_auto_scale | ( | lfModifier * | modifier,
|  | cbool | reverse
| ) |  |

See also
  lfModifier::GetAutoScale

## ◆ 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
| ) |  |

See also
  lfModifier::Initialize

## ◆ lf_modifier_new()

DEPRECATED lfModifier * lf_modifier_new | ( | const lfLens * | lens,
|  | float | crop,
|  | int | width,
|  | int | height
| ) |  |

See also
  lfModifier::lfModifier