colour_demosaicing.mosaicing_CFA_Bayer

colour_demosaicing.mosaicing_CFA_Bayer(RGB, pattern='RGGB')[source]

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

Parameters:
  • RGB (array_like) – RGB colourspace array.
  • pattern (unicode, optional) – {‘RGGB’, ‘BGGR’, ‘GRBG’, ‘GBRG’}, Arrangement of the colour filters on the pixel array.
Returns:

Bayer CFA mosaic.

Return type:

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.]])