This notebook showcase various Bayer CFA (Colour Filter Array) related examples.
Note: All the showcased objects support an optional pattern argument specifying the arrangement of the colour filters on the pixel array: 'RGGB', 'BGGR', 'GRBG', 'GBRG'
In [1]:
from __future__ import division
import os
import colour
from colour.plotting import *
from colour_demosaicing import (
EXAMPLES_RESOURCES_DIRECTORY,
demosaicing_CFA_Bayer_bilinear,
demosaicing_CFA_Bayer_Malvar2004,
demosaicing_CFA_Bayer_Menon2007,
mosaicing_CFA_Bayer)
cctf_encoding = colour.cctf_encoding
colour.utilities.filter_warnings()
colour.utilities.describe_environment();
In [2]:
colour_style();
In [3]:
LIGHTHOUSE_IMAGE = colour.io.read_image(
os.path.join(EXAMPLES_RESOURCES_DIRECTORY, 'bayer', 'Lighthouse.exr'))
plot_image(cctf_encoding(LIGHTHOUSE_IMAGE),
{'text': 'Lighthouse - R914108 - Kodak'});
In [4]:
CFA = mosaicing_CFA_Bayer(LIGHTHOUSE_IMAGE)
plot_image(cctf_encoding(CFA),
{'text': 'Lighthouse - CFA - RGGB'})
plot_image(cctf_encoding(mosaicing_CFA_Bayer(LIGHTHOUSE_IMAGE, 'BGGR')),
{'text': 'Lighthouse - CFA - BGGR'});
In [5]:
plot_image(cctf_encoding(demosaicing_CFA_Bayer_bilinear(CFA)),
{'text': 'Lighthouse - Demosaicing - Bilinear'});
In [6]:
plot_image(cctf_encoding(demosaicing_CFA_Bayer_Malvar2004(CFA)),
{'text': 'Lighthouse - Demosaicing - Malvar (2004)'});
In [7]:
plot_image(cctf_encoding(demosaicing_CFA_Bayer_Menon2007(CFA)),
{'text': 'Lighthouse - Demosaicing - Menon (2007)'});