components.photo.vignettecorrector

pyctools.components.photo.vignettecorrector.VignetteCorrector

Vignette corrector.

pyctools.components.photo.vignettecorrector.AnalyseVignette

Vignette analysis.

class VignetteCorrector(config={}, **kwds)[source]

Bases: Transformer

Vignette corrector.

Adjust the brightness of images with a radially varying gain function. This should be applied to ‘linear intensity’ image data before gamma correction is applied.

The mode parameter sets the function to use. The param_n values set how the correction varies with radius. Their meaning depends on the function. The AnalyseVignette component can be used to generate optimised values.

Config

mode

str

Function to use. Possible values: 'power', 'poly2', 'poly3', 'lin2', 'lin3', 'invlin2', 'invlin3'.

param_0

float

First function parameter.

param_1

float

Second function parameter.

param_2

float

Third function parameter.

param_3

float

Fourth function parameter.

param_4

float

Fifth function parameter.

class AnalyseVignette(config={}, **kwds)[source]

Bases: Transformer

Vignette analysis.

Measures the average luminance of 50 circular bands of an input grey image, then calculates the optimum function parameters to correct it.

The mode configuration selects the function to fit. If set to measure or inv_measure no function is fitted. In inv_measure mode the output shows the vignetting instead of the required correction. Available functions are:

power

1.0 + (a * (r ^ b))

poly2

1.0 + (a * (r ^ 2)) + (b * (r ^ 4))

poly3

1.0 + (a * (r ^ 2)) + (b * (r ^ 4)) + (c * (r ^ 6))

lin2

2-segment piecewise linear

lin3

3-segment piecewise linear

invlin2

inverse 2-segment piecewise linear

invlin3

inverse 3-segment piecewise linear

The function output emits the measured and fitted gain values. It can be connected to a PlotData component.

The plot... parameters can be used to control the plot’s appearance. Running the component network several times with different options allows quite complex plots to be built up.

Config

mode

str

Function to fit. Possible values: 'measure', 'inv_measure', 'power', 'poly2', 'poly3', 'lin2', 'lin3', 'invlin2', 'invlin3'.

method

str

Curve fitting method: lm, trf, or dogbox.

plot_measurement

bool

Include the measured input in the plot.

plot_error

bool

Include the residual error in the plot.

plot_label_measured

str

Label for the ‘measured’ plot.

plot_label_fitted

str

Label for the ‘fitted’ plot. If left blank mode is used.

outputs = ['output', 'function']

Comments or questions? Please email jim@jim-easterbrook.me.uk.