0001
0002
0003
0004
0005
0006
0007 clc;
0008 clear;
0009
0010
0011 addpath misc/
0012 addpath prox_operators/
0013
0014
0015 N = 32;
0016 input_snr = 1;
0017 randn('seed', 1);
0018
0019
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
0027 S = randn(N^2, N^2)/N^2;
0028 im = reshape(S\im_ref(:), N, N);
0029
0030
0031 y = im;
0032 sigma_noise = 10^(-input_snr/20)*std(im_ref(:));
0033 y = y + randn(size(y))*sigma_noise;
0034
0035
0036
0037 param.verbose = 2;
0038 param.gamma = 1;
0039 param.rel_obj = 1e-4;
0040 param.max_iter = 100;
0041 param.max_iter_TV = 100;
0042 param.nu_B2 = 1;
0043 param.tight_B2 = 1;
0044 param.nu_TV = norm(S)^2;
0045 func_S = @(x) reshape(S*x(:), N, N);
0046 func_St = @(x) reshape(S'*x(:), N, N);
0047
0048 epsilon = sqrt(chi2inv(0.99, numel(im)))*sigma_noise;
0049
0050 A = @(x) x;
0051
0052 sol = sopt_mltb_solve_TVDNoA(y, epsilon, A, A, func_S, func_St, param);
0053
0054 figure(2);
0055 imagesc(func_S(sol)); axis image; axis off;
0056 colormap gray; title('Reconstructed image'); drawnow;