colour.contrast.contrast_sensitivity_function_Barten1999

colour.contrast.contrast_sensitivity_function_Barten1999(u, sigma=0.0087911571732306338, k=3.0, T=0.1, X_0=60, Y_0=None, X_max=12, Y_max=None, N_max=15, n=0.03, p=1227400.0, E=66.082316060529919, phi_0=3.0000000000000004e-08, u_0=7)[source]

Returns the contrast sensitivity \(S\) of the human eye according to the contrast sensitivity function (CSF) described by Barten (1999).

Contrast sensitivity is defined as the inverse of the modulation threshold of a sinusoidal luminance pattern. The modulation threshold of this pattern is generally defined by 50% probability of detection. The contrast sensitivity function or CSF gives the contrast sensitivity as a function of spatial frequency. In the CSF, the spatial frequency is expressed in angular units with respect to the eye. It reaches a maximum between 1 and 10 cycles per degree with a fall off at higher and lower spatial frequencies.

Parameters:
  • u (numeric) – Spatial frequency \(u\), the cycles per degree.
  • sigma (numeric or array_like, optional) – Standard deviation \(\sigma\) of the line-spread function resulting from the convolution of the different elements of the convolution process.
  • k (numeric or array_like, optional) – Signal-to-noise (SNR) ratio \(k\).
  • T (numeric or array_like, optional) – Integration time \(T\) in seconds of the eye.
  • X_0 (numeric or array_like, optional) – Angular size \(X_0\) in degrees of the object in the x direction.
  • Y_0 (numeric or array_like, optional) – Angular size \(Y_0\) in degrees of the object in the y direction.
  • X_max (numeric or array_like, optional) – Maximum angular size \(X_{max}\) in degrees of the integration area in the x direction.
  • Y_max (numeric or array_like, optional) – Maximum angular size \(Y_{max}\) in degrees of the integration area in the y direction.
  • N_max (numeric or array_like, optional) – Maximum number of cycles \(N_{max}\) over which the eye can integrate the information.
  • n (numeric or array_like, optional) – Quantum efficiency of the eye \(n\).
  • p (numeric or array_like, optional) – Photon conversion factor \(p\) in \(photons\div seconds\div degrees^2\div Trolands\) that depends on the light source.
  • E (numeric or array_like, optional) – Retinal illuminance \(E\) in Trolands.
  • phi_0 (numeric or array_like, optional) – Spectral density \(\phi_0\) in \(seconds degrees^2\) of the neural noise.
  • u_0 (numeric or array_like, optional) – Spatial frequency \(u_0\) in \(cycles\div degrees\) above which the lateral inhibition ceases.
Returns:

Contrast sensitivity \(S\).

Return type:

ndarray

Warning

This definition expects \(\sigma_{0}\) and \(C_{ab}\) used in the computation of \(\sigma\) to be given in degrees and \(degrees\div mm\) respectively. However, in the literature, the values for \(\sigma_{0}\) and \(C_{ab}\) are usually given in \(arc min\) and \(arc min\div mm\) respectively, thus they need to be divided by 60.

Notes

  • The formula holds for bilateral viewing and for equal dimensions of the object in x and y direction. For monocular vision, the contrast sensitivity is a factor \(\sqrt{2}\) smaller.
  • Barten (1999) CSF default values for the \(k\), \(\sigma_{0}\), \(C_{ab}\), \(T\), \(X_{max}\), \(N_{max}\), \(n\), \(\phi_{0}\) and \(u_0\) constants are valid for a standard observer with good vision and with an age between 20 and 30 years.
  • The other constants have been filled using reference data from Figure 31 in [InternationalTUnion15c] but must be adapted to the current use case.
  • The product of \(u\), the cycles per degree, and \(X_0\), the number of degrees, gives the number of cycles \(P_c\) in a pattern. Therefore, \(X_0\) can be made a variable dependent on \(u\) such as \(X_0 = P_c / u\).

References

[Bar99], [Bar03], [CKM+04], [InternationalTUnion15c],

Examples

>>> contrast_sensitivity_function_Barten1999(4)  # doctest: +ELLIPSIS
360.8691122...

Reproducing Figure 31 in [InternationalTUnion15c] illustrating the minimum detectable contrast according to Barten (1999) model with the assumed conditions for UHDTV applications. The minimum detectable contrast \(MDC\) is then defined as follows:

:math:`MDC = 1 / CSF * 2 * (1 / 1.27)`

where \(2\) is used for the conversion from modulation to contrast and \(1 / 1.27\) is used for the conversion from sinusoidal to rectangular waves.

>>> from scipy.optimize import fmin
>>> settings_BT2246 = {
...     'k': 3.0,
...     'T': 0.1,
...     'X_max': 12,
...     'N_max': 15,
...     'n': 0.03,
...     'p': 1.2274 * 10 ** 6,
...     'phi_0': 3 * 10 ** -8,
...     'u_0': 7,
... }
>>>
>>> def maximise_spatial_frequency(L):
...     maximised_spatial_frequency = []
...     for L_v in L:
...         X_0 = 60
...         d = pupil_diameter_Barten1999(L_v, X_0)
...         sigma = sigma_Barten1999(0.5 / 60, 0.08 / 60, d)
...         E = retinal_illuminance_Barten1999(L_v, d, True)
...         maximised_spatial_frequency.append(
...             fmin(lambda x: (
...                     -contrast_sensitivity_function_Barten1999(
...                         u=x,
...                         sigma=sigma,
...                         X_0=X_0,
...                         E=E,
...                         **settings_BT2246)
...                 ), 0, disp=False)[0])
...         return as_float(np.array(maximised_spatial_frequency))
>>>
>>> L = np.logspace(np.log10(0.01), np.log10(100), 10)
>>> X_0 = Y_0 = 60
>>> d = pupil_diameter_Barten1999(L, X_0, Y_0)
>>> sigma = sigma_Barten1999(0.5 / 60, 0.08 / 60, d)
>>> E = retinal_illuminance_Barten1999(L, d)
>>> u = maximise_spatial_frequency(L)
>>> (1 / contrast_sensitivity_function_Barten1999(
...     u=u, sigma=sigma, E=E, X_0=X_0, Y_0=Y_0, **settings_BT2246)
...  * 2 * (1/ 1.27))
... # doctest: +ELLIPSIS
array([ 0.0207396...,  0.0134885...,  0.0096063...,  0.0077299...,  0.0068983...,
        0.0065057...,  0.0062712...,  0.0061198...,  0.0060365...,  0.0059984...])