diff --git a/src/methods/GERAYELI_Kourosh/.gitkeep b/src/methods/GERAYELI_Kourosh/.gitkeep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/methods/GERAYELI_Kourosh/GERAYELI_Kourosh.py b/src/methods/GERAYELI_Kourosh/GERAYELI_Kourosh.py new file mode 100644 index 0000000000000000000000000000000000000000..196b6163c4dea43808789bf654e4650a2bebb732 --- /dev/null +++ b/src/methods/GERAYELI_Kourosh/GERAYELI_Kourosh.py @@ -0,0 +1,66 @@ + +# Importing libraries +import os +import colour +from colour_demosaicing import ( + demosaicing_CFA_Bayer_bilinear, + demosaicing_CFA_Bayer_Malvar2004, + demosaicing_CFA_Bayer_Menon2007, + mosaicing_CFA_Bayer) + +from src.utils import psnr,ssim + +# Image path +image_pathes = ['images/img_1.png','images/img_2.png','images/img_3.png','images/img_4.png'] + +for i in image_pathes: + LIGHTHOUSE_IMAGE = colour.io.read_image(i) + img = LIGHTHOUSE_IMAGE + colour.plotting.plot_image( + colour.cctf_encoding(LIGHTHOUSE_IMAGE)) + + + # Mosaicing + CFA = mosaicing_CFA_Bayer(LIGHTHOUSE_IMAGE) + + colour.plotting.plot_image( + colour.cctf_encoding(CFA), + text_kwargs={'text': 'Lighthouse - CFA - RGGB'}) + + colour.plotting.plot_image( + colour.cctf_encoding(mosaicing_CFA_Bayer(LIGHTHOUSE_IMAGE, 'BGGR')), + text_kwargs={'text': 'Lighthouse - CFA - BGGR'}); + + + # Demosaicing bilinear + colour.plotting.plot_image( + colour.cctf_encoding(demosaicing_CFA_Bayer_bilinear(CFA)), + text_kwargs={'text': 'Demosaicing - Bilinear'}); + + recons_bilinear = colour.cctf_encoding(demosaicing_CFA_Bayer_bilinear(CFA)) + + + # demosaicing Malvar + recons_malvar = colour.cctf_encoding(demosaicing_CFA_Bayer_Malvar2004(CFA)) + colour.plotting.plot_image( + colour.cctf_encoding(demosaicing_CFA_Bayer_Malvar2004(CFA)), + text_kwargs={'text': 'Demosaicing - Malvar (2004)'}); + + # demosaicing Menon + recons_menon = colour.cctf_encoding(demosaicing_CFA_Bayer_Menon2007(CFA)) + colour.plotting.plot_image( + colour.cctf_encoding(demosaicing_CFA_Bayer_Menon2007(CFA)), + text_kwargs={'text': 'Demosaicing - Menon (2007)'}); + + + print('bilinear : ') + print(f'PSNR: {psnr(img, recons_bilinear):.2f}') + print(f'SSIM: {ssim(img, recons_bilinear):.4f}') + + print('Malvar : ') + print(f'PSNR: {psnr(img, recons_malvar):.2f}') + print(f'SSIM: {ssim(img, recons_malvar):.4f}') + + print('Menon') + print(f'PSNR: {psnr(img, recons_menon):.2f}') + print(f'SSIM: {ssim(img, recons_menon):.4f}') \ No newline at end of file diff --git a/src/methods/GERAYELI_Kourosh/GERAYELI_Kourosh_Finalexam.pdf b/src/methods/GERAYELI_Kourosh/GERAYELI_Kourosh_Finalexam.pdf new file mode 100644 index 0000000000000000000000000000000000000000..88a33dda6f3830605123630f46a6e56b76c549dd Binary files /dev/null and b/src/methods/GERAYELI_Kourosh/GERAYELI_Kourosh_Finalexam.pdf differ