colour_demosaicing.mosaicing_CFA_Bayer#

colour_demosaicing.mosaicing_CFA_Bayer(RGB: ArrayLike, pattern: Literal['RGGB', 'BGGR', 'GRBG', 'GBRG'] | str = 'RGGB') → NDArray[source]#

Return the Bayer CFA mosaic for a given RGB colourspace array.

Parameters:
  • RGB (ArrayLike) – RGB colourspace array.

  • pattern (Literal['RGGB', 'BGGR', 'GRBG', 'GBRG'] | str) – Arrangement of the colour filters on the pixel array.

Returns:

Bayer CFA mosaic.

Return type:

numpy.ndarray

Examples

>>> import numpy as np
>>> RGB = np.array([[[0, 1, 2], [0, 1, 2]], [[0, 1, 2], [0, 1, 2]]])
>>> mosaicing_CFA_Bayer(RGB)
array([[0., 1.],
       [1., 2.]])
>>> mosaicing_CFA_Bayer(RGB, pattern="BGGR")
array([[2., 1.],
       [1., 0.]])