colour_hdri.generation Package

Module Contents

colour_hdri.generation.normal_distribution_function(a, mu=0.5, sigma=0.15)[source]

Returns given array weighted by a normal distribution function.

Parameters:
  • a (array_like) – Array to apply the weighting function onto.
  • mu (numeric, optional) – Mean or expectation.
  • sigma (numeric, optional) – Standard deviation.
Returns:

Weighted array.

Return type:

ndarray

Examples

>>> normal_distribution_function(np.linspace(0, 1, 10))
array([ 0.00386592,  0.03470859,  0.18002174,  0.53940751,  0.93371212,
        0.93371212,  0.53940751,  0.18002174,  0.03470859,  0.00386592])
colour_hdri.generation.hat_function(a)[source]

Returns given array weighted by a hat function.

Parameters:a (array_like) – Array to apply the weighting function onto.
Returns:Weighted array.
Return type:ndarray

Examples

>>> hat_function(np.linspace(0, 1, 10))
array([ 0.        ,  0.95099207,  0.99913557,  0.99999812,  1.        ,
        1.        ,  0.99999812,  0.99913557,  0.95099207,  0.        ])
colour_hdri.generation.weighting_function_Debevec1997(a, domain_l=0.01, domain_h=0.99)[source]

Returns given array weighted by Debevec (1997) function.

Parameters:
  • a (array_like) – Array to apply the weighting function onto.
  • domain_l (numeric, optional) – Domain lowest possible value, values less than domain_l will be set to zero.
  • domain_h (numeric, optional) – Domain highest possible value, values greater than domain_h will be set to zero.
Returns:

Weighted array.

Return type:

ndarray

References

[1]Debevec, P., & Malik, J. (1997). Recovering High Dynamic Range Radiance Maps from Photographs, (August), 1–10. doi:10.1145/258734.258884

Examples

>>> weighting_function_Debevec1997(np.linspace(0, 1, 10))
array([ 0.        ,  0.23273657,  0.48849105,  0.74424552,  1.        ,
        1.        ,  0.74424552,  0.48849105,  0.23273657,  0.        ])
colour_hdri.generation.image_stack_to_radiance_image(image_stack, weighting_function=<function weighting_function_Debevec1997>, weighting_average=False, camera_response_functions=None)[source]

Generates a HDRI / radiance image from given image stack.

Parameters:
  • image_stack (ImageStack) – Stack of single channel or multi-channel floating point images. The stack is assumed to be representing linear values except if camera_response_functions argument is provided.
  • weighting_function (callable, optional) – Weighting function \(w\).
  • weighting_average (bool, optional) – Enables weighting function \(w\) computation on channels average instead of on a per channel basis.
  • camera_response_functions (array_like, optional) – Camera response functions \(g(z)\) of the imaging system / camera if the stack is representing non linear values.
Returns:

Radiance image.

Return type:

ndarray

Warning

If the image stack contains images with negative or equal to zero values, unpredictable results may occur and NaNs might be generated. It is thus recommended to encode the images in a wider RGB colourspace or clamp negative values.