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:
Transformer
Gamma correction.
Convert linear intensity values to ‘gamma corrected’ form suitable for display or storage in standard video or image files.
In
inverse
mode 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
black
level input produces a gamma corrected output of 0 and linear intensitywhite
level input produces an output of 255. The linear intensity black and white values are set by theblack
andwhite
config items. You can use anArithmetic
orComputerToStudio
component to scale the output if required.The
scale
option 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
function
output emits the transfer function data whenever it changes. It can be connected to aPlotData
component.Config
black
float
“Linear intensity” black level.
white
float
“Linear intensity” white level.
scale
float
Adjust the range of some functions.
gamma
str
Choose a gamma curve. Possible values:
'linear'
,'bt709'
,'srgb'
,'adobe_rgb'
,'hybrid_log'
,'S-Log'
,'Canon-Log'
.knee
bool
Turn on “knee” (highlight compression).
knee_point
float
Highlight compression threshold (normalised 0..1 range).
knee_slope
float
Slope of transfer function above knee threshold.
inverse
bool
- outputs = ['output', 'function']
- class PiecewiseGammaCorrect(config={}, **kwds)[source]
Bases:
Transformer
Gamma 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_vals
values, and extrapolation is used for data outside the range ofin_vals
.The
function
output emits the transfer function data whenever it changes. It can be connected to thePlotData
component.The
smooth
option (present if scipy is installed) converts the series of data points to a smooth curve using cubic spline interpolation.Config
in_vals
str
List of input values, in increasing order.
out_vals
str
List of corresponding output values.
inverse
bool
smooth
bool
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_val
and the corresponding output valuesout_val
. Linear interpolation is used to map input values that lie between members of thein_val
list. Input values outside the range ofin_val
are 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.