clear;
clc;

% No noise, circular wrap around

I = im2double(imread('ref_synth_cb_lg.tif')); 
PSF = fspecial('motion',100,0);
B = imfilter(I,PSF,'circular','conv');
imwrite(B,'synth_cb_circ_lg.tif'); 

I = im2double(imread('ref_synth_cb_md.tif')); 
PSF = fspecial('motion',50,0);
B = imfilter(I,PSF,'circular','conv');
imwrite(B,'synth_cb_circ_md.tif'); 


I = im2double(imread('ref_synth_cb_sm.tif')); 
PSF = fspecial('motion',25,0);
B = imfilter(I,PSF,'circular','conv');
imwrite(B,'synth_cb_circ_sm.tif'); 


% No noise, replicate wrap around

I = im2double(imread('ref_synth_cb_lg.tif')); 
PSF = fspecial('motion',100,0);
B = imfilter(I,PSF,'replicate','conv');
imwrite(B,'synth_cb_rep_lg.tif'); 

I = im2double(imread('ref_synth_cb_md.tif')); 
PSF = fspecial('motion',50,0);
B = imfilter(I,PSF,'replicate','conv');
imwrite(B,'synth_cb_rep_md.tif'); 


I = im2double(imread('ref_synth_cb_sm.tif')); 
PSF = fspecial('motion',25,0);
B = imfilter(I,PSF,'replicate','conv');
imwrite(B,'synth_cb_rep_sm.tif'); 

% Gaussian noise, circular wrap around

I = im2double(imread('ref_synth_cb_lg.tif'));
%I = imnoise(I,'gaussian',0,0.01);
PSF = fspecial('motion',100,0);
B = imfilter(I,PSF,'replicate','conv');
B = imnoise(B,'gaussian',0,0.01);
imwrite(B,'synth_cb_noise_lg.tif'); 

I = im2double(imread('ref_synth_cb_md.tif'));
%I = imnoise(I,'gaussian',0,0.01);
PSF = fspecial('motion',50,0);
B = imfilter(I,PSF,'replicate','conv');
B = imnoise(B,'gaussian',0,0.01);
imwrite(B,'synth_cb_noise_md.tif'); 


I = im2double(imread('ref_synth_cb_sm.tif')); 
%I = imnoise(I,'gaussian',0,0.01);
PSF = fspecial('motion',25,0);
B = imfilter(I,PSF,'replicate','conv');
B = imnoise(B,'gaussian',0,0.01);
imwrite(B,'synth_cb_noise_sm.tif'); 






