function Image_Inpainting_Test(Im , missingPixelsRatio , noiseSig)
% Run synthetic inpainting+denoising tests, 
% using local patch-based processing with the DCT overcomplete dictionary
% missingPixelsRatio is the part of the pixels that are removed 
%                       (0.2 means 20% of the pixels are removed)
% noiseSig is the standard deviation of the noise

% Read image
trueIm = double(Im);

% Create noisy image
% noisyIm = trueIm + noiseSig * randn(size(trueIm));
% noisyIm(noisyIm < 0) = 0; noisyIm(noisyIm > 255) = 0;
noisyIm = trueIm;


% Prepare mask
thick = 12;
Mask = ones(256,256);

for i=1:thick
%    Mask(i,:)=0;
%    Mask(:,+i)=0;
%    Mask(257-i,:)=0;
   Mask(:,257-i)=0;
end

Mask = logical(Mask);

% Mask = rand(size(trueIm)) > missingPixelsRatio;
maskedNoisyIm = noisyIm .* Mask;

% Inpaint the image
[ResIm , ResIm_OMPonly] = Image_Inpainting(trueIm, maskedNoisyIm , Mask , noiseSig);

% Show results
figure; imshow(trueIm , [0 255]); title('True Im');

figure; imshow(maskedNoisyIm , [0 255]); 
P = Compute_Error_Stats(maskedNoisyIm , trueIm); 
title(sprintf('Masked & noisy Im , %02.2f dB' , P));

figure; imshow(ResIm_OMPonly , [0 255]); 
P = Compute_Error_Stats(ResIm_OMPonly , trueIm); 
title(sprintf('Result , %02.2f dB' , P));

figure; imshow(ResIm , [0 255]); 
P = Compute_Error_Stats(ResIm , trueIm); 
title(sprintf('Result, replacing only missing pixels , %02.2f dB' , P));

% Finished
return;
