colour_demosaicing.demosaicing_CFA_Bayer_DDFAPD

colour_demosaicing.demosaicing_CFA_Bayer_DDFAPD(CFA, pattern='RGGB', refining_step=True)

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

Parameters:
  • CFA (array_like) – Bayer CFA.
  • pattern (unicode, optional) – {‘RGGB’, ‘BGGR’, ‘GRBG’, ‘GBRG’}, Arrangement of the colour filters on the pixel array.
  • refining_step (bool) – Perform refining step.
Returns:

RGB colourspace array.

Return type:

ndarray

Notes

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

References

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]],
<BLANKLINE>
       [[ 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]],
<BLANKLINE>
       [[ 0.30588236,  0.35686275,  0.3764706 ],
        [ 0.30980393,  0.36078432,  0.39411766],
        [ 0.29607844,  0.36078432,  0.40784314],
        [ 0.29803923,  0.3764706 ,  0.42352942]]])