colour_demosaicing.demosaicing_CFA_Bayer_Malvar2004¶
-
colour_demosaicing.
demosaicing_CFA_Bayer_Malvar2004
(CFA, pattern='RGGB')[source]¶ Returns the demosaiced RGB colourspace array from given Bayer CFA using Malvar (2004) demosaicing algorithm.
Parameters: - CFA (array_like) – Bayer CFA.
- pattern (unicode, optional) – {‘RGGB’, ‘BGGR’, ‘GRBG’, ‘GBRG’}, Arrangement of the colour filters on the pixel array.
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_Malvar2004(CFA) array([[[ 0.30980393, 0.31666668, 0.32941177], [ 0.33039216, 0.36078432, 0.38112746], [ 0.30588236, 0.32794118, 0.34877452], [ 0.36274511, 0.3764706 , 0.38480393]], <BLANKLINE> [[ 0.34828432, 0.35686275, 0.36568628], [ 0.35318628, 0.38186275, 0.39607844], [ 0.3379902 , 0.36078432, 0.3754902 ], [ 0.37769609, 0.39558825, 0.40000001]]]) >>> CFA = np.array( ... [[0.3764706, 0.360784320, 0.40784314, 0.3764706], ... [0.35686275, 0.30980393, 0.36078432, 0.29803923]]) >>> demosaicing_CFA_Bayer_Malvar2004(CFA, 'BGGR') array([[[ 0.35539217, 0.37058825, 0.3764706 ], [ 0.34264707, 0.36078432, 0.37450981], [ 0.36568628, 0.39607844, 0.40784314], [ 0.36568629, 0.3764706 , 0.3882353 ]], <BLANKLINE> [[ 0.34411765, 0.35686275, 0.36200981], [ 0.30980393, 0.32990197, 0.34975491], [ 0.33039216, 0.36078432, 0.38063726], [ 0.29803923, 0.30441178, 0.31740197]]])