components.colourspace.gammacorrection
|
Gamma correction. |
|
Gamma correction with a piecewise linear transform. |
|
Apply a transfer function to a single 3-D |
- class GammaCorrect(config={}, **kwds)[source]
Bases:
TransformerGamma correction.
Convert linear intensity values to ‘gamma corrected’ form suitable for display or storage in standard video or image files.
In
inversemode gamma corrected data is converted to linear intensity.The
'hybrid_log'gamma option is an implementation of a proposal from BBC R&D for HDR imaging. See http://www.bbc.co.uk/rd/publications/whitepaper309 for more information.The
'S-Log'option is taken from a Sony document https://pro.sony.com/bbsccms/assets/files/mkt/cinema/solutions/slog_manual.pdf'Canon-Log'is taken from a white paper on the EOS C300 camera: http://learn.usa.canon.com/app/pdfs/white_papers/White_Paper_Clog_optoelectronic.pdfThe gamma options have all been normalised so that linear intensity
blacklevel input produces a gamma corrected output of 0 and linear intensitywhitelevel input produces an output of 255. The linear intensity black and white values are set by theblackandwhiteconfig items. You can use anArithmeticorComputerToStudiocomponent to scale the output if required.The
scaleoption adjusts the input and output ranges without changing the mapping from input white to output 255. With some functions this acts as a highlight compression adjustment.The
functionoutput emits the transfer function data whenever it changes. It can be connected to aPlotDatacomponent.Config
blackfloat
“Linear intensity” black level.
whitefloat
“Linear intensity” white level.
scalefloat
Adjust the range of some functions.
gammastr
Choose a gamma curve. Possible values:
'linear','bt709','srgb','adobe_rgb','hybrid_log','S-Log','Canon-Log'.kneebool
Turn on “knee” (highlight compression).
knee_pointfloat
Highlight compression threshold (normalised 0..1 range).
knee_slopefloat
Slope of transfer function above knee threshold.
inversebool
- outputs = ['output', 'function']
- class PiecewiseGammaCorrect(config={}, **kwds)[source]
Bases:
TransformerGamma correction with a piecewise linear transform.
The transform is specified as a series of input values and corresponding output values. Linear interpolation is used to convert data that lies between
in_valsvalues, and extrapolation is used for data outside the range ofin_vals.The
functionoutput emits the transfer function data whenever it changes. It can be connected to thePlotDatacomponent.The
smoothoption (present if scipy is installed) converts the series of data points to a smooth curve using cubic spline interpolation.Config
in_valsstr
List of input values, in increasing order.
out_valsstr
List of corresponding output values.
inversebool
smoothbool
Smooth transform with cubic spline interpolation. Requires scipy.
- outputs = ['output', 'function']
- apply_transfer_function(frame, in_val, out_val)
Apply a transfer function to a single 3-D
numpy.ndarray.The function is defined by two 1-D arrays - input values
in_valand the corresponding output valuesout_val. Linear interpolation is used to map input values that lie between members of thein_vallist. Input values outside the range ofin_valare mapped by extrapolation from the first or last two values.- Parameters:
frame (numpy.ndarray) – Input/output image.
in_val (numpy.ndarray) – Function inputs.
out_val (numpy.ndarray) – Function outputs.
Comments or questions? Please email jim@jim-easterbrook.me.uk.