|
LensSerious 0.1
Lens-correction mathematics as data, not as a library of callbacks
|
A lens correction the camera maker measured and wrote into the file, as knots. More...
#include <lensserious.h>
Collaboration diagram for ls_knots_t:Data Fields | |
| int | n |
| float | radius [16] |
| float | cor_rgb [3][16] |
| int | vn |
| float | vig_radius [16] |
| float | vig [16] |
A lens correction the camera maker measured and wrote into the file, as knots.
The second source of correction data this library resolves, beside the lens database. Most mirrorless makers – Sony, Fujifilm, Olympus, and anyone writing DNG 1.3 opcodes – embed a profile of the lens that took the picture in its metadata, and they all express it the same way: a short list of radii and, at each, the factor the coordinate should be scaled by. Not a model with coefficients; the samples themselves, meant to be read back with straight-line interpolation between them.
Two things about the shape of it matter to everything downstream:
cor_rgb holds red, green and blue separately, so distortion and lateral chromatic aberration arrive measured together rather than as a geometry plus a correction on top of it. There is no TCA stage to run afterwards.radius, and vig_radius with it, are the distance from the IMAGE CENTRE over half the image diagonal – 1.0 at the far corner. That is the makers' own convention and this library adopts it wholesale rather than converting, so the numbers a decoder lifts out of the file go in unmodified.
Definition at line 162 of file lensserious.h.
| float ls_knots_t::cor_rgb[3][16] |
At each radius, source_radius / this_radius, per channel: 0 red, 1 green, 2 blue. The direction is the CORRECTING one – given a point in the corrected image, where in the source image it came from – which is what the makers publish and what a resampler consumes. Ask ls_modifier_init_knots() for the other one and it inverts the table.
Definition at line 172 of file lensserious.h.
Referenced by _dng_populate(), _fuji_populate(), _olympus_populate(), _sony_populate(), ls_modifier_init_knots(), and ls_vendor_resolve().
| int ls_knots_t::n |
How many distortion/TCA knots, up to LS_MAX_KNOTS. Zero for none.
Definition at line 165 of file lensserious.h.
Referenced by ls_modifier_init_knots(), and ls_vendor_resolve().
| float ls_knots_t::radius[16] |
Ascending radii, n of them, shared by all three channels.
Definition at line 167 of file lensserious.h.
Referenced by _dng_populate(), _fuji_populate(), _olympus_populate(), _sony_populate(), ls_modifier_init_knots(), and ls_vendor_resolve().
| float ls_knots_t::vig[16] |
The falloff itself, as the maker measured it: below 1 where the lens darkens. A pixel is CORRECTED by dividing by it, which is upstream lensfun's convention too.
Definition at line 180 of file lensserious.h.
Referenced by _dng_populate(), _fuji_populate(), _olympus_populate(), _sony_populate(), and ls_modifier_init_knots().
| float ls_knots_t::vig_radius[16] |
Ascending radii for vig, in the same units as radius.
Definition at line 177 of file lensserious.h.
Referenced by _dng_populate(), _fuji_populate(), _olympus_populate(), _sony_populate(), and ls_modifier_init_knots().
| int ls_knots_t::vn |
How many vignetting knots. Zero for none; independent of n.
Definition at line 175 of file lensserious.h.
Referenced by ls_modifier_init_knots(), and ls_vendor_resolve().