summaryrefslogtreecommitdiffstats
path: root/Wrappers/Matlab/demos
diff options
context:
space:
mode:
authorDaniil Kazantsev <dkazanc@hotmail.com>2018-04-09 09:38:35 +0100
committerDaniil Kazantsev <dkazanc@hotmail.com>2018-04-09 09:38:35 +0100
commitbb86cf3cb44fa66a2def258d346ebb68fe14ed61 (patch)
tree8b2ee60f2e5d3a1d7bfd05b2f7b6c24bc5715249 /Wrappers/Matlab/demos
parent2e9d7e5df33c3c042b2a55ae4c9fe23b15f95019 (diff)
downloadregularization-bb86cf3cb44fa66a2def258d346ebb68fe14ed61.tar.gz
regularization-bb86cf3cb44fa66a2def258d346ebb68fe14ed61.tar.bz2
regularization-bb86cf3cb44fa66a2def258d346ebb68fe14ed61.tar.xz
regularization-bb86cf3cb44fa66a2def258d346ebb68fe14ed61.zip
fixes a memory leak in FGP-TV(CPU)#43, matlab CPU/GPU wrappers and demos
Diffstat (limited to 'Wrappers/Matlab/demos')
-rw-r--r--Wrappers/Matlab/demos/demoMatlab_denoise.m38
-rw-r--r--Wrappers/Matlab/demos/demoMatlab_denoise.m~31
2 files changed, 69 insertions, 0 deletions
diff --git a/Wrappers/Matlab/demos/demoMatlab_denoise.m b/Wrappers/Matlab/demos/demoMatlab_denoise.m
new file mode 100644
index 0000000..7258e5e
--- /dev/null
+++ b/Wrappers/Matlab/demos/demoMatlab_denoise.m
@@ -0,0 +1,38 @@
+% Image (2D) denoising demo using CCPi-RGL
+
+addpath('../mex_compile/installed');
+addpath('../../../data/');
+
+Im = double(imread('lena_gray_256.tif'))/255; % loading image
+u0 = Im + .05*randn(size(Im)); u0(u0 < 0) = 0;
+figure; imshow(u0, [0 1]); title('Noisy image');
+
+%%
+fprintf('Denoise using ROF-TV model (CPU) \n');
+lambda_rof = 0.03; % regularization parameter
+tau_rof = 0.0025; % time-marching constant
+iter_rof = 2000; % number of ROF iterations
+tic; u_rof = ROF_TV(single(u0), lambda_rof, iter_rof, tau_rof); toc;
+figure; imshow(u_rof, [0 1]); title('ROF-TV denoised image (CPU)');
+%%
+% fprintf('Denoise using ROF-TV model (GPU) \n');
+% lambda_rof = 0.03; % regularization parameter
+% tau_rof = 0.0025; % time-marching constant
+% iter_rof = 2000; % number of ROF iterations
+% tic; u_rofG = ROF_TV_GPU(single(u0), lambda_rof, iter_rof, tau_rof); toc;
+% figure; imshow(u_rofG, [0 1]); title('ROF-TV denoised image (GPU)');
+%%
+fprintf('Denoise using FGP-TV model (CPU) \n');
+lambda_fgp = 0.03; % regularization parameter
+iter_fgp = 1000; % number of FGP iterations
+epsil_tol = 1.0e-05; % tolerance
+tic; u_fgp = FGP_TV(single(u0), lambda_fgp, iter_fgp, epsil_tol); toc;
+figure; imshow(u_fgp, [0 1]); title('FGP-TV denoised image (CPU)');
+%%
+% fprintf('Denoise using FGP-TV model (GPU) \n');
+% lambda_fgp = 0.03; % regularization parameter
+% iter_fgp = 1000; % number of FGP iterations
+% epsil_tol = 1.0e-05; % tolerance
+% tic; u_fgpG = FGP_TV_GPU(single(u0), lambda_fgp, iter_fgp, epsil_tol); toc;
+% figure; imshow(u_fgpG, [0 1]); title('FGP-TV denoised image (GPU)');
+%% \ No newline at end of file
diff --git a/Wrappers/Matlab/demos/demoMatlab_denoise.m~ b/Wrappers/Matlab/demos/demoMatlab_denoise.m~
new file mode 100644
index 0000000..3f4403e
--- /dev/null
+++ b/Wrappers/Matlab/demos/demoMatlab_denoise.m~
@@ -0,0 +1,31 @@
+% Image (2D) denoising demo using CCPi-RGL
+
+addpath('../mex_compile/installed');
+addpath('../../../data/');
+
+Im = double(imread('lena_gray_256.tif'))/255; % loading image
+u0 = Im + .05*randn(size(Im)); u0(u0 < 0) = 0;
+figure; imshow(u0, [0 1]); title('Noisy image');
+
+%%
+fprintf('Denoise using ROF-TV model (CPU) \n');
+lambda_rof = 0.02; % regularization parameter
+tau_rof = 0.0025; % time-marching constant
+iter_rof = 2000; % number of ROF iterations
+tic; u_rof = ROF_TV(single(u0), lambda_rof, iter_rof, tau_rof); toc;
+figure; imshow(u_rof, [0 1]); title('ROF-TV denoised image (CPU)');
+%%
+% fprintf('Denoise using ROF-TV model (GPU) \n');
+% lambda_rof = 0.02; % regularization parameter
+% tau_rof = 0.0025; % time-marching constant
+% iter_rof = 2000; % number of ROF iterations
+% tic; u_rof = ROF_TV_GPU(single(u0), lambda_rof, iter_rof, tau_rof); toc;
+% figure; imshow(u_rof, [0 1]); title('ROF-TV denoised image (GPU)');
+%%
+fprintf('Denoise using FGP-TV model (CPU) \n');
+lambda_fgp = 0.02; % regularization parameter
+iter_fgp = 2000; % number of FGP iterations
+epsil_tol = 1.0e-05; % tolerance
+tic; u_fgp = FGP_TV(single(u0), lambda_fgp, iter_fgp, epsil_tol); toc;
+figure; imshow(u_rof, [0 1]); title('ROF-TV denoised image (CPU)');
+%% \ No newline at end of file