
% The code can only be used for research purpose.

% Please cite the following paper when you use it:
    %Lei Zhang and David Zhang
    %“A joint demosaicking-zooming scheme for single sensor digital color cameras”, 
    %Computer Vision and Image Understanding, Special issue on Color Image Processing,
    %vol. 107, pp. 14-25, July-Aug, 2007.
    
%Note: The code is not optimized and may have bugs. Your revision and improvement are welcome!


clear all;

%%read the CFA mosaic image
I=imread('s_fence.tif','tif');%the downsampled CFA image "fence"
I=double(I);
figure(1),clf;
imshow(I, [0 255]);

%%joint demosaicking and zooming%%%%%%%%%%%%%%%%%
A=dmsc_b(I);
B=zoomcd3(A);
figure(2),clf;
imshow(B/255);

%%compute the PSNR%%%
tI=imread('kodak_fence.tif','tif');%%this is the original full color image "fence"
tI=double(tI);
figure(3),clf;
imshow(tI/255);
snrf=csnr(tI,B,20,20)
