
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                            %
%                       WaRD Algorithm Implementation                        %
%                                                                            %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% This code specifies the experimental setup required to demonstrate the
% performance of Wavelet-domain Regularized Deconvolution (WaRD) algorithm
% proposed by Ramesh Neelamani, Hyeokho Choi and Richard Baraniuk from 
% Rice University.
% 
% Reference: R. Neelamani, H. Choi, and R. G. Baraniuk, ``Wavelet-based
% deconvolution for ill-conditioned systems,'' IEEE Transactions on Image
% Processing (submitted Feb 2000). 
% Check http://www.dsp.rice.edu/publications/pubs/neelsh00tip.ps.Z to
% download the reference.
%
% Your comments would be highly appreciated. Please send them to 
% neelsh@eice.edu
%
% This program uses some routines from the  Rice Wavelet toolbox.
%
% Copyright: All software, documentation, and related files in this 
%            distribution are Copyright (c) 2000 Rice University
%
% Permission is granted for use and non-profit distribution providing that this
% notice be clearly maintained. The right to distribute any portion for profit
% or as part of any commercial product is specifically reserved for the author.


% Which Input signal would you like? Choose the corresponding number
% (1) Cameraman (default)
% (2) Lenna 
% (3) Theater
% (4) Boats
% (5) Birthday
% The images are grayscale images
Input_signal = 3;

% Which blurring function would you like?
% (1)  Box car blur (9x9 blur) (default)
% (2)  Adjustable Box car blur (you specify the amount of blur size later)
% (3)  Circular blur with radius 7
% (4)  Low pass filter used by Kalifa et al. in 
%      "Image Deconvolution in Mirror Wavelet bases", ICIP 98, pg. 565-569,
%      Chicago, 1998.

Blur = 3;

% What blurred-signal-to-noise ratio (in dB) would you like?
% If y = x*h + n is the deconvolution model, the BSNR = |norm(x*h)/norm(n)|^2
% default is 40 dB (* denotes convolution)

BSNR = 40;

% Two wavelet basis are required for implementing the wavelet-domain wiener
% filter (WDWF) used to perform the estimation. See daubcqf.m to set the
% type wavelet filter. 

Wavelet_Filt_type1 = daubcqf(6,'min'); 
Wavelet_Filt_type2 = daubcqf(2,'min'); 

% What threshold should be used in for hard thresholding (1st stage in WDWF)?
% default threshold is 3*sigma, sigma is standard deviation of noise.

Thresh_Factor = 3.0;

% How many levels of decomposition do you want?
% The maximum possible is log(N), however 4 levels are often sufficient.

Decomp_levels = 3;

% Do you want to estimate the power spectral density (PSD) of the input
% signal from the observation or do you want to use the original signal to
% get the PSD? The PSD is required for the Wiener filter and the WaRD
% algorithm.
% Choices are PSD = 'Estimate'
%             PSD = 'Original'
% NOTE: For arbitrary images, the estimation 

PSD = 'Estimate';

% Do you want to estimate the noise variance of the input
% signal from the observation or do you want to use the original signal to
% get the PSD? The noise variance is required for the Wiener filter and the 
% WaRD algorithm.
% Choices are Variance = 'Estimate'
%             Variance = 'Original'
%

Variance = 'Estimate';

% What regularization parameter \alpha would you like to use?
% Typically, the value 0.1 gives excellent estimates.
% Note: You could use the program Estimate_reg_param.m to help you choose a
% regularization parameter as described in the 
reg_param = 0.1;
%reg_param = 0.02;


% This runs the experiment.
WaRD_Setup

% We are now in a position to run the WaRD algorithm.
Run_WaRD

% We are now in a position to display the results
Disp_results













