Skip to content
Snippets Groups Projects
Commit 208936c5 authored by Carla Di Geronimo's avatar Carla Di Geronimo
Browse files

Replace reconstruct.py

parent 25942cba
No related branches found
No related tags found
1 merge request!1Master
......@@ -7,6 +7,7 @@ Students can call their functions (declared in others files of src/methods/your_
import numpy as np
from src.forward_model import CFA
from src.methods.template.somefunc import spectral_difference, normalization, quad_bayer_to_bayer_pattern, quad_bayer_to_bayer_image, bilinear_interpolation
def run_reconstruction(y: np.ndarray, cfa: str) -> np.ndarray:
......@@ -20,11 +21,26 @@ def run_reconstruction(y: np.ndarray, cfa: str) -> np.ndarray:
np.ndarray: Demosaicked image.
"""
# Performing the reconstruction.
# TODO
input_shape = (y.shape[0], y.shape[1], 3)
op = CFA(cfa, input_shape)
return np.zeros(op.input_shape)
if op.cfa != 'bayer' and op.cfa != 'quad_bayer':
raise ValueError("CFA must be bayer or quad_bayer")
if op.cfa == 'quad_bayer':
quad_bayer_to_bayer_pattern(op)
quad_bayer_to_bayer_image(y)
# Apply adjoint operation on raw aquisition
z = op.adjoint(y)
# Demosaicing process
res_bi = bilinear_interpolation(op, z)
res_sd = spectral_difference(op, z, res_bi)
res = normalization(res_sd) # min-max normalization
return res
####
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment