diff options
author | Tomas Kulhanek <tomas.kulhanek@stfc.ac.uk> | 2019-02-28 16:24:01 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-28 16:24:01 +0000 |
commit | 879c87c5709ee194a8c7a2207f5a21d4a757f723 (patch) | |
tree | eddf7bc14a998ffabc7e9e01f0cca2ac44b1d88a /demos/demoMatlab_inpaint.m | |
parent | 4c728cf72345f7ab7967380cb536529fd9b1403d (diff) | |
parent | 68e6f3397e8a450854f39a5d514e1f747b9031a4 (diff) | |
download | regularization-879c87c5709ee194a8c7a2207f5a21d4a757f723.tar.gz regularization-879c87c5709ee194a8c7a2207f5a21d4a757f723.tar.bz2 regularization-879c87c5709ee194a8c7a2207f5a21d4a757f723.tar.xz regularization-879c87c5709ee194a8c7a2207f5a21d4a757f723.zip |
Merge pull request #104 from vais-ral/newdirstructure
New directory structure, Merged other changes. The build script checks old and new structure.
Diffstat (limited to 'demos/demoMatlab_inpaint.m')
-rw-r--r-- | demos/demoMatlab_inpaint.m | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/demos/demoMatlab_inpaint.m b/demos/demoMatlab_inpaint.m new file mode 100644 index 0000000..a85f2b9 --- /dev/null +++ b/demos/demoMatlab_inpaint.m @@ -0,0 +1,35 @@ +% Image (2D) inpainting demo using CCPi-RGL +clear; close all +Path1 = sprintf(['..' filesep 'src' filesep 'Matlab' filesep 'mex_compile' filesep 'installed'], 1i); +Path2 = sprintf(['data' filesep], 1i); +addpath(Path1); +addpath(Path2); + +load('SinoInpaint.mat'); +Sinogram = Sinogram./max(Sinogram(:)); +Sino_mask = Sinogram.*(1-single(Mask)); +figure; +subplot(1,2,1); imshow(Sino_mask, [0 1]); title('Missing data sinogram'); +subplot(1,2,2); imshow(Mask, [0 1]); title('Mask'); +%% +fprintf('Inpaint using Linear-Diffusion model (CPU) \n'); +iter_diff = 5000; % number of diffusion iterations +lambda_regDiff = 6000; % regularisation for the diffusivity +sigmaPar = 0.0; % edge-preserving parameter +tau_param = 0.000075; % time-marching constant +tic; u_diff = NonlDiff_Inp(single(Sino_mask), Mask, lambda_regDiff, sigmaPar, iter_diff, tau_param); toc; +figure; imshow(u_diff, [0 1]); title('Linear-Diffusion inpainted sinogram (CPU)'); +%% +fprintf('Inpaint using Nonlinear-Diffusion model (CPU) \n'); +iter_diff = 1500; % number of diffusion iterations +lambda_regDiff = 80; % regularisation for the diffusivity +sigmaPar = 0.00009; % edge-preserving parameter +tau_param = 0.000008; % time-marching constant +tic; u_diff = NonlDiff_Inp(single(Sino_mask), Mask, lambda_regDiff, sigmaPar, iter_diff, tau_param, 'Huber'); toc; +figure; imshow(u_diff, [0 1]); title('Non-Linear Diffusion inpainted sinogram (CPU)'); +%% +fprintf('Inpaint using Nonlocal Vertical Marching model (CPU) \n'); +Increment = 1; % linear increment for the searching window +tic; [u_nom,maskupd] = NonlocalMarching_Inpaint(single(Sino_mask), Mask, Increment); toc; +figure; imshow(u_nom, [0 1]); title('NVM inpainted sinogram (CPU)'); +%%
\ No newline at end of file |