colour.contrast.contrast_sensitivity_function_Barten1999#

colour.contrast.contrast_sensitivity_function_Barten1999(u: ArrayLike, sigma: ArrayLike = sigma_Barten1999(0.5 / 60, 0.08 / 60, 2.1), k: ArrayLike = 3.0, T: ArrayLike = 0.1, X_0: ArrayLike = 60, Y_0: ArrayLike | None = None, X_max: ArrayLike = 12, Y_max: ArrayLike | None = None, N_max: ArrayLike = 15, n: ArrayLike = 0.03, p: ArrayLike = 1.2274 * 10**6, E: ArrayLike = retinal_illuminance_Barten1999(20, 2.1), phi_0: ArrayLike = 3 * 10**-8, u_0: ArrayLike = 7) NDArrayFloat[source]#

Return 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 (ArrayLike) – Spatial frequency \(u\), the cycles per degree.

  • sigma (ArrayLike) – Standard deviation \(\sigma\) of the line-spread function resulting from the convolution of the different elements of the convolution process.

  • k (ArrayLike) – Signal-to-noise (SNR) ratio \(k\).

  • T (ArrayLike) – Integration time \(T\) in seconds of the eye.

  • X_0 (ArrayLike) – Angular size \(X_0\) in degrees of the object in the x direction.

  • Y_0 (ArrayLike | None) – Angular size \(Y_0\) in degrees of the object in the y direction.

  • X_max (ArrayLike) – Maximum angular size \(X_{max}\) in degrees of the integration area in the x direction.

  • Y_max (ArrayLike | None) – Maximum angular size \(Y_{max}\) in degrees of the integration area in the y direction.

  • N_max (ArrayLike) – Maximum number of cycles \(N_{max}\) over which the eye can integrate the information.

  • n (ArrayLike) – Quantum efficiency of the eye \(n\).

  • p (ArrayLike) – Photon conversion factor \(p\) in \(photons\div seconds\div degrees^2\div Trolands\) that depends on the light source.

  • E (ArrayLike) – Retinal illuminance \(E\) in Trolands.

  • phi_0 (ArrayLike) – Spectral density \(\phi_0\) in \(seconds degrees^2\) of the neural noise.

  • u_0 (ArrayLike) – Spatial frequency \(u_0\) in \(cycles\div degrees\) above which the lateral inhibition ceases.

Returns:

Contrast sensitivity \(S\).

Return type:

numpy.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], [CKMW04], [InternationalTUnion15c],

Examples

>>> contrast_sensitivity_function_Barten1999(4)  
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)
... )
... 
array([ 0.0218764...,  0.0141848...,  0.0095244...,  0.0066805...,  0.0049246...,
        0.0038228...,  0.0031188...,  0.0026627...,  0.0023674...,  0.0021814...])