diff --git a/Contents.m b/Contents.m index 1c32df0..92e7173 100644 --- a/Contents.m +++ b/Contents.m @@ -6,5 +6,5 @@ % % % For help, bug reports, suggestions etc. please send email to -% unlocbox-help@lists.sourceforge.net +% unlocbox (at) groupes (dot) epfl (dot) ch % diff --git a/demos/Contents.m b/demos/Contents.m index 112eba1..c9d6a16 100644 --- a/demos/Contents.m +++ b/demos/Contents.m @@ -20,7 +20,6 @@ % DEMO_DEQUANTIZATION - Solves a dequantization problem % % Other demo -% DEMO_OVERLAPING_GROUPS_STRUCTURED_SPARSITY - Demonstration of the use of overlapping groups in structured sparsity % DEMO_ADMM - Demonstration of the use of the admm solver % DEMO_SDMM - Demonstration of the use of the SDMM solver % DEMO_WEIGHTED_L1 - Demonstration of the use of the bpdn solver @@ -30,3 +29,7 @@ % For help, bug reports, suggestions etc. please send email to % unlocbox (at) groupes (dot) epfl (dot) ch % + + + +% DEMO_OVERLAPING_GROUPS_STRUCTURED_SPARSITY - Demonstration of the use of overlapping groups in structured sparsity diff --git a/demos/demo_inpainting_webcam.m b/demos/demo_inpainting_webcam.m new file mode 100644 index 0000000..0411f30 --- /dev/null +++ b/demos/demo_inpainting_webcam.m @@ -0,0 +1,142 @@ + +% Author : Nathanaël Perraudin +% +% This demo capture a image with the webcam and perform some inpainting +% with it. + +clear; + +close all; + +init_unlocbox; + +%% parameter + +scale = 0.5; % scale for the image +imgcolor = 1; +p = 0.8 ; + +verbose = 2; % Verbosity level +maxit = 30; + +%% + +% Close previous cam if3 any +clear('cam') + +camList = webcamlist; +% Is there any cam? + +if numel(camList)>1 + fprintf('Please choose a webcam:\n'); + for ii = 1:numel(camList) + fprintf([' ',num2str(ii),') ',camList{ii},'\n']) + end + fprintf('Camera number: ') + prompt = 1; + numCam = str2num(input('','s')); +else + numCam = 1; +end + +%% Start the webcam + +cam = webcam(numCam); +%% Aquire image + +preview(cam); + +fprintf('Push a button to aquire image... ') +pause; + +% Acquire a single image. +rgbImage = snapshot(cam); +fprintf(' Done! \n') + +rgbImage = imresize(rgbImage, scale); +if imgcolor + im_original = double(rgbImage)/256; +else + % Convert RGB to grayscale and rescaling. + grayImage = double(rgb2gray(rgbImage))/256; + % Original image + im_original = grayImage; +end + +closePreview(cam) +clear('cam') + +%% + + +%% Creation of the problem + + + +% Creating the problem +A = rand(size(im_original,1),size(im_original,2)); +A = A > p; + +if imgcolor + A = cat(3,A,A,A); +end + +% Depleted image +b = A .* im_original; + + +imagesc_gray(im_original, 1, 'Original image'); +imagesc_gray(b, 2, 'Depleted image'); + +pause; + +%% Defining proximal operators + +% Define the prox of f2 see the function proj_B2 for more help +operatorA = @(x) A.*x; +operatorAt = @(x) A.*x; +epsilon2 = 0; +param_proj.epsilon = epsilon2; +param_proj.A = operatorA; +param_proj.At = operatorAt; +param_proj.y = b; +param_proj.verbose = verbose - 1; +f2.prox=@(x,T) proj_b2(x, T, param_proj); +f2.eval=@(x) eps; + +f2.prox = @(x,T) (x - A.*x) + A.*b; + + +% setting the function f1 (norm TV) +param_tv.verbose = verbose - 1; +param_tv.maxit = maxit; + +f1.prox = @(x, T) prox_tv(x, T, param_tv); +f1.eval = @(x) sum(norm_tv(x)); + +%% solving the problem + +% setting different parameter for the simulation +paramsolver.verbose = verbose; % display parameter +paramsolver.maxit = maxit; % maximum iteration +paramsolver.tol = 10e-7; % tolerance to stop iterating +paramsolver.gamma = 0.1; % stepsize + +% To see the evolution of the reconstruction +fig = figure(100); +paramsolver.do_sol = @(x) plot_image(x,fig,1); + +sol = douglas_rachford(b,f1,f2,paramsolver); + +close(100); + +%% displaying the result +sol(sol<0) = 0; +sol(sol>1) = 1; +imagesc_gray(im_original, 1, 'Original image'); +imagesc_gray(b, 2, 'Depleted image'); +imagesc_gray(sol, 3, 'Reconstructed image'); + + +%% Closing the toolbox +close_unlocbox(); diff --git a/demos/demo_overlaping_groups_structured_sparsity.m b/demos/demo_overlaping_groups_structured_sparsity.m index 4a68283..4d30848 100644 --- a/demos/demo_overlaping_groups_structured_sparsity.m +++ b/demos/demo_overlaping_groups_structured_sparsity.m @@ -70,6 +70,7 @@ %% Initialisation +error('Not working') clear; close all; @@ -129,7 +130,7 @@ % setting the function f1 (l1 norm of the Gabor transform) % set parameters -param_l12.verbose = verbose - 1; +param_l21.verbose = verbose - 1; @@ -169,12 +170,12 @@ % -------------------------------------------- % -param_l12.g_t = g_t; -param_l12.g_d = g_d; -param_l12.maxit = 5; +param_l21.g_t = g_t; +param_l21.g_d = g_d; +param_l21.maxit = 5; -f1.prox=@(x, T) prox_l21(x, T*tau, param_l12); +f1.prox=@(x, T) prox_l21(x, T*tau, param_l21); f1.eval=@(x) tau*norm_l21(x,g_d, g_t); diff --git a/demos/demo_tvdn.m b/demos/demo_tvdn.m index 267f9e6..b6330fe 100644 --- a/demos/demo_tvdn.m +++ b/demos/demo_tvdn.m @@ -21,17 +21,17 @@ % % .. figure:: % -% First problem +% Measurements +% +% % -% In painting with 33% of known pixel and a SNR of 30dB % - % .. figure:: % -% Second problem +% In painting with 33% of known pixel and a SNR of 30dB +% +% % -% Image reconstruction with 33% of the Fourier measurements and a SNR -% of 30dB. % Author: Gilles Puy, Nathanael Perraudin % Date: Nov. 1, 2012 @@ -72,7 +72,7 @@ sigma_noise = 10^(-input_snr/20)*std(im(:)); y = y + randn(size(y))*sigma_noise; % Display the downsampled image -imagesc_gray(At(y),2,'Measured image',121); +imagesc_gray(At(y),2,'Measured image'); % Parameters for TVDN param.verbose = 2; % Print log or not param.gamma = 0.1; % Stepsize @@ -88,7 +88,7 @@ % Solve TVDN problem sol = solve_tvdn(y, epsilon, A, At, param); % Show reconstructed image -imagesc_gray(sol, 2, 'Reconstructed image',122); +imagesc_gray(sol, 3, 'Reconstructed image'); % %% Second problem: Reconstruct from 33% of Fourier measurements diff --git a/prox/prox_l12.m b/prox/prox_l12.m index 53f4360..7502d41 100644 --- a/prox/prox_l12.m +++ b/prox/prox_l12.m @@ -80,7 +80,7 @@ % % See also: prox_l1 prox_linf1 prox_l21 prox_sumg % -% Demos: demo_compress_sensing3 demo_overlaping_groups_structured_sparsity +% Demos: demo_compress_sensing3 % % References: bach2011optimization kowalski2013social kowalski2009sparse kowalski2009sparsity % diff --git a/prox/prox_l21.m b/prox/prox_l21.m index ef42406..eb9a723 100644 --- a/prox/prox_l21.m +++ b/prox/prox_l21.m @@ -84,8 +84,6 @@ % % See also: prox_l1 prox_linf1 prox_l12 prox_sumg % -% Demos: demo_compress_sensing3 demo_overlaping_groups_structured_sparsity -% % References: bach2011optimization kowalski2013social kowalski2009sparse kowalski2009sparsity % Author: Nathanael Perraudin @@ -226,8 +224,8 @@ G{k}=g; end + param4 = param; param4.G=G; - param4.verbose=param.verbose; sol=prox_sumg(x,gamma,param4); end diff --git a/demos/dequantization_dataset_01.mat b/signals/dequantization_dataset_01.mat similarity index 100% rename from demos/dequantization_dataset_01.mat rename to signals/dequantization_dataset_01.mat diff --git a/unlocbox_version b/unlocbox_version index 943f9cb..f8a696c 100644 --- a/unlocbox_version +++ b/unlocbox_version @@ -1 +1 @@ -1.7.1 +1.7.2