colour_hdri.calibration Package

Module Contents

colour_hdri.calibration.upper_hemisphere_illuminance_weights_Lagarde2016(height, width)[source]

Computes upper hemisphere illuminance weights for use with applications unable to perform the computation directly, i.e. Adobe Photoshop.

Parameters:
  • height (int) – Output array height.
  • width (int) – Output array width.
Returns:

Upper hemisphere illuminance weights.

Return type:

ndarray

Examples

>>> upper_hemisphere_illuminance_weights_Lagarde2016(  # doctest: +ELLIPSIS
...    16, 1)
array([[ 0...        ],
       [ 4.0143297...],
       [ 7.3345454...],
       [ 9.3865515...],
       [ 9.8155376...],
       [ 8.5473281...],
       [ 5.8012079...],
       [ 2.0520061...],
       [ 0...        ],
       [ 0...        ],
       [ 0...        ],
       [ 0...        ],
       [ 0...        ],
       [ 0...        ],
       [ 0...        ],
       [ 0...        ]])
colour_hdri.calibration.absolute_luminance_calibration_Lagarde2016(RGB, measured_illuminance, colourspace=None)[source]

Performs absolute Luminance calibration of given RGB panoramic image using Lagarde (2016) method.

Parameters:
  • RGB (array_like) – RGB panoramic image to calibrate.
  • measured_illuminance (numeric) – Measured illuminance \(E_v\).
  • colourspace (colour.RGB_Colourspace, optional) – RGB colourspace used for internal Luminance computation.
Returns:

Absolute Luminance calibrated RGB panoramic image.

Return type:

ndarray

Examples

>>> RGB = np.ones((4, 8, 3))
>>> absolute_luminance_calibration_Lagarde2016(  # doctest: +ELLIPSIS
...     RGB, 500)
array([[[ 233.9912506...,  233.9912506...,  233.9912506...],
        [ 233.9912506...,  233.9912506...,  233.9912506...],
        [ 233.9912506...,  233.9912506...,  233.9912506...],
        [ 233.9912506...,  233.9912506...,  233.9912506...],
        [ 233.9912506...,  233.9912506...,  233.9912506...],
        [ 233.9912506...,  233.9912506...,  233.9912506...],
        [ 233.9912506...,  233.9912506...,  233.9912506...],
        [ 233.9912506...,  233.9912506...,  233.9912506...]],
<BLANKLINE>
       [[ 233.9912506...,  233.9912506...,  233.9912506...],
        [ 233.9912506...,  233.9912506...,  233.9912506...],
        [ 233.9912506...,  233.9912506...,  233.9912506...],
        [ 233.9912506...,  233.9912506...,  233.9912506...],
        [ 233.9912506...,  233.9912506...,  233.9912506...],
        [ 233.9912506...,  233.9912506...,  233.9912506...],
        [ 233.9912506...,  233.9912506...,  233.9912506...],
        [ 233.9912506...,  233.9912506...,  233.9912506...]],
<BLANKLINE>
       [[ 233.9912506...,  233.9912506...,  233.9912506...],
        [ 233.9912506...,  233.9912506...,  233.9912506...],
        [ 233.9912506...,  233.9912506...,  233.9912506...],
        [ 233.9912506...,  233.9912506...,  233.9912506...],
        [ 233.9912506...,  233.9912506...,  233.9912506...],
        [ 233.9912506...,  233.9912506...,  233.9912506...],
        [ 233.9912506...,  233.9912506...,  233.9912506...],
        [ 233.9912506...,  233.9912506...,  233.9912506...]],
<BLANKLINE>
       [[ 233.9912506...,  233.9912506...,  233.9912506...],
        [ 233.9912506...,  233.9912506...,  233.9912506...],
        [ 233.9912506...,  233.9912506...,  233.9912506...],
        [ 233.9912506...,  233.9912506...,  233.9912506...],
        [ 233.9912506...,  233.9912506...,  233.9912506...],
        [ 233.9912506...,  233.9912506...,  233.9912506...],
        [ 233.9912506...,  233.9912506...,  233.9912506...],
        [ 233.9912506...,  233.9912506...,  233.9912506...]]])
colour_hdri.calibration.g_solve(Z, B, l=30, w=<function weighting_function_Debevec1997>, n=256)[source]

Given a set of pixel values observed for several pixels in several images with different exposure times, this function returns the imaging system’s response function \(g\) as well as the log film irradiance values \(lE\) for the observed pixels.

Parameters:
  • Z (array_like) – Set of pixel values observed for several pixels in several images.
  • B (array_like) – Log \(\Delta t\), or log shutter speed for images.
  • l (numeric, optional) – \(\lambda\) smoothing term.
  • w (callable, optional) – Weighting function \(w\).
  • n (int, optional) – \(n\) constant.
Returns:

Camera response functions \(g(z)\) and log film irradiance values \(lE\).

Return type:

tuple

colour_hdri.calibration.camera_response_functions_Debevec1997(image_stack, s=<function samples_Grossberg2003>, samples=1000, l=30, w=<function weighting_function_Debevec1997>, n=256, normalise=True)[source]

Returns the camera response functions for given image stack using Debevec (1997) method.

Image channels are sampled with \(s\) sampling function and the output samples are passed to g_solve().

Parameters:
  • image_stack (ImageStack) – Stack of single channel or multi-channel floating point images.
  • s (callable, optional) – Sampling function \(s\).
  • samples (int, optional) – Samples count per images.
  • l (numeric, optional) – \(\lambda\) smoothing term.
  • w (callable, optional) – Weighting function \(w\).
  • n (int, optional) – \(n\) constant.
  • normalise (bool, optional) – Enables the camera response functions normalisation. Uncertain camera response functions values resulting from \(w\) function are set to zero.
Returns:

Camera response functions \(g(z)\).

Return type:

ndarray