From 205ffbebfe1081249425b8c79e511873e91e8a80 Mon Sep 17 00:00:00 2001
From: Kourosh Gerayeli <kourosh.gerayeli@grenoble-inp.org>
Date: Sun, 4 Feb 2024 20:40:46 +0100
Subject: [PATCH] Upload New File

---
 .../GERAYELI_Kourosh/GERAYELI_Kourosh.py      | 66 +++++++++++++++++++
 1 file changed, 66 insertions(+)
 create mode 100644 src/methods/GERAYELI_Kourosh/GERAYELI_Kourosh.py

diff --git a/src/methods/GERAYELI_Kourosh/GERAYELI_Kourosh.py b/src/methods/GERAYELI_Kourosh/GERAYELI_Kourosh.py
new file mode 100644
index 0000000..196b616
--- /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
-- 
GitLab