# colour_hdri.sampling.variance_minimization Module

## Viriyothai (2009) Variance Minimization Light Probe Sampling

Defines Viriyothai (2009) variance minimization light probe sampling objects:

- `light_probe_sampling_variance_minimization_Viriyothai2009()`

References

[1] | Viriyothai, K., & Debevec, P. (2009). Variance minimization light probe sampling. SIGGRAPH’09: Posters, (Egsr), 60558. doi:10.1145/1599301.1599393

class `colour_hdri.sampling.variance_minimization.``Light_Specification`

  Bases: `colour_hdri.sampling.variance_minimization.Light_Specification`

  Defines a light probe sampling resulting light specification.

  Parameters: | uv (array_like) – \(uv\) coordinates of the sampled light. colour (array_like) – Sampled light colour. index (array_like) – Sampled light location index in its original array.

`colour_hdri.sampling.variance_minimization.``luminance_variance`(a)

  Computes the Luminance variance of given \(a\) 2-D array.

  Parameters: | a (array_like) – \(a\) 2-D array to compute the Luminance variation.
  Returns: | \(a\) 2-D array Luminance variance.
  Return type: | numeric

  Examples

      >>> a = np.tile(np.arange(5), (5, 1))
      >>> luminance_variance(a)
      12.2474487...

`colour_hdri.sampling.variance_minimization.``find_regions_variance_minimization_Viriyothai2009`(a, n=4)

  Finds the \(2^n\) regions using Viriyothai (2009) variance minimization light probe sampling algorithm on given \(a\) 2-D array.

  Parameters: | a (array_like) – \(a\) 2-D array to find the regions. n (int) – Iterations count, the total regions count is \(2^n\).
  Returns: | Regions with variance minimized.
  Return type: | list

`colour_hdri.sampling.variance_minimization.``highlight_regions_variance_minimization`(a, regions, highlight_colour=array([0, 1, 0]))

  Highlights regions using with variance minimized on given \(a\) 3-D array.

  Parameters: | a (array_like) – \(a\) 3-D array to highlight the regions. regions (array_like) – Regions with variance minimized. highlight_colour (array_like) – Highlight colour.
  Returns: | \(a\) 3-D array with highlighted regions.
  Return type: | ndarray

`colour_hdri.sampling.variance_minimization.``light_probe_sampling_variance_minimization_Viriyothai2009`(light_probe, lights_count=16, colourspace=None)

  Sample given light probe to find lights using Viriyothai (2009) variance minimization light probe sampling algorithm.

  Parameters: | light_probe (array_like) – Array to sample for lights. lights_count (int) – Amount of lights to generate. colourspace (colour.RGB_Colourspace, optional) – RGB colourspace used for internal Luminance computation.
  Returns: | list of `Light_Specification` lights.
  Return type: | list