%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Analysis and reconstruction of 2-dimensional signals (images) within a
% multiresolution framework, using Gabor-like wavelets.
%
% Version: April 20, 2008
% Author : K.N. Chaudhury
%
% References:
%
% [1] K.N. Chaudhury and M. Unser, Construction of Hilbert transform pairs
% of wavelet bases and Gabor-like transforms, IEEE Transactions on Signal
% Processing, vol. 57, no. 9, pp. 3411-3425, 2009.
%
% [2] K.N. Chaudhury, Optimally Localized Wavelets and Smoothing Kernels,
% Swiss Federal Institute of Technology Lausanne, EPFL, Thesis no. 4968.
%
%
% Notations:
%
% inImg: Input image of size M x N, where M = N (square) and dyadic
% alpha: Degree of the fractional B-spline
% tau = 0 (default)
% P1, P2: Projection filters
% H, HH: Lowpass filters on the analysis and synthesis sides
% G, GG: Highpass filters on the analysis and synthesis sides
% w: Complex wavelet coefficients
% lowpass: Coarsest approximations
%
%
% All filtering (convolution) operations are performed in the Fourier
% space; see [2] for implementation details.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all; close all; clc
% input image
inImg = double(imread('images/octagon.tif'));
% exceptions
flag = exception(inImg);
if ~flag
fprintf('Aborted!\n');
return;
end
% parameters
alpha = input(' Enter value of alpha (e.g., alpha = 12): ');
J = input(' Enter the level of decomposition (e.g., J = 3) : ');
tau = 0; % default
% analysis
[w, lowpass, L1, L2, L3, L4] = analysis(inImg, J, alpha, tau);
% synthesis
reconImg = synthesis(lowpass, w, J, alpha, tau, L1, L2, L3, L4);
% display results
fprintf( 'Reconstruction error (L2-norm) = %e \n', ...
norm(inImg - reconImg, 'fro') );
displayFigures(inImg, w, reconImg);