colour_demosaicing.demosaicing_CFA_Bayer_DDFAPD#

colour_demosaicing.demosaicing_CFA_Bayer_DDFAPD(CFA: ArrayLike, pattern: Literal['RGGB', 'BGGR', 'GRBG', 'GBRG'] | str = 'RGGB', refining_step: bool = True)#

Return the demosaiced RGB colourspace array from given Bayer CFA using DDFAPD - Menon (2007) demosaicing algorithm.

Parameters:
  • CFA (ArrayLike) – Bayer CFA.

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

  • refining_step (bool) – Perform refining step.

Returns:

RGB colourspace array.

Return type:

numpy.ndarray

Notes

  • The definition output is not clipped in range [0, 1] : this allows for direct HDRI image generation on Bayer CFA data and post demosaicing of the high dynamic range data as showcased in this Jupyter Notebook.

References

[MAC07]

Examples

>>> CFA = np.array(
...     [
...         [0.30980393, 0.36078432, 0.30588236, 0.3764706],
...         [0.35686275, 0.39607844, 0.36078432, 0.40000001],
...     ]
... )
>>> demosaicing_CFA_Bayer_Menon2007(CFA)
array([[[ 0.30980393,  0.35686275,  0.39215687],
        [ 0.30980393,  0.36078432,  0.39607844],
        [ 0.30588236,  0.36078432,  0.39019608],
        [ 0.32156864,  0.3764706 ,  0.40000001]],

       [[ 0.30980393,  0.35686275,  0.39215687],
        [ 0.30980393,  0.36078432,  0.39607844],
        [ 0.30588236,  0.36078432,  0.39019609],
        [ 0.32156864,  0.3764706 ,  0.40000001]]])
>>> CFA = np.array(
...     [
...         [0.3764706, 0.36078432, 0.40784314, 0.3764706],
...         [0.35686275, 0.30980393, 0.36078432, 0.29803923],
...     ]
... )
>>> demosaicing_CFA_Bayer_Menon2007(CFA, "BGGR")
array([[[ 0.30588236,  0.35686275,  0.3764706 ],
        [ 0.30980393,  0.36078432,  0.39411766],
        [ 0.29607844,  0.36078432,  0.40784314],
        [ 0.29803923,  0.3764706 ,  0.42352942]],

       [[ 0.30588236,  0.35686275,  0.3764706 ],
        [ 0.30980393,  0.36078432,  0.39411766],
        [ 0.29607844,  0.36078432,  0.40784314],
        [ 0.29803923,  0.3764706 ,  0.42352942]]])