Home > matlab > Example_TVDNoA.m

Example_TVDNoA

PURPOSE ^

% Example TVDNoA

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

% Example TVDNoA
 Example to demonstrate TVoA_B2 solver, where an additional operator is
 included in the TV norm of the TVDN problem.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %% Example TVDNoA
0002 % Example to demonstrate TVoA_B2 solver, where an additional operator is
0003 % included in the TV norm of the TVDN problem.
0004 
0005 
0006 %% Clear workspace
0007 clc;
0008 clear;
0009 
0010 %% Define paths
0011 addpath misc/
0012 addpath prox_operators/
0013 
0014 %% Parameters
0015 N = 32;
0016 input_snr = 1; % Noise level (on the measurements)
0017 randn('seed', 1);
0018 
0019 %% Load an image
0020 im_ref = phantom(N);
0021 %
0022 figure(1);
0023 imagesc(im_ref); axis image; axis off;
0024 colormap gray; title('Original image'); drawnow;
0025 
0026 %% Create an artifial operator to test prox_TVoS
0027 S = randn(N^2, N^2)/N^2;
0028 im = reshape(S\im_ref(:), N, N); % S*im is thus sparse in TV
0029 
0030 %% Add Gaussian i.i.d. noise to im
0031 y = im;
0032 sigma_noise = 10^(-input_snr/20)*std(im_ref(:));
0033 y = y + randn(size(y))*sigma_noise;
0034 
0035 %% Solving modified ROF
0036 % Parameters for TVDN
0037 param.verbose = 2; % Print log or not
0038 param.gamma = 1; % Converge parameter
0039 param.rel_obj = 1e-4; % Stopping criterion for the TVDN problem
0040 param.max_iter = 100; % Max. number of iterations for the TVDN problem
0041 param.max_iter_TV = 100; % Max. nb. of iter. for the sub-problem (proximal TV operator)
0042 param.nu_B2 = 1; % Bound on the norm of the measurement operator (Id here)
0043 param.tight_B2 = 1; % Indicate that A is a tight frame (1) or not (0)
0044 param.nu_TV = norm(S)^2; % Bound on the norm of the operator S
0045 func_S = @(x) reshape(S*x(:), N, N);
0046 func_St = @(x) reshape(S'*x(:), N, N);
0047 % Tolerance on noise
0048 epsilon = sqrt(chi2inv(0.99, numel(im)))*sigma_noise;
0049 % Identity
0050 A = @(x) x;
0051 % Solve
0052 sol = sopt_mltb_solve_TVDNoA(y, epsilon, A, A, func_S, func_St, param);
0053 % Show reconstructed image
0054 figure(2);
0055 imagesc(func_S(sol)); axis image; axis off;
0056 colormap gray; title('Reconstructed image'); drawnow;

Generated on Fri 22-Feb-2013 15:54:47 by m2html © 2005