aboutsummaryrefslogtreecommitdiff
path: root/tveq_phantom_example.m
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2021-01-29 16:23:05 -0500
committerEugeniy E. Mikhailov <evgmik@gmail.com>2021-01-29 16:23:05 -0500
commit3983eb46023c1edd00617729ba929057fda8d0bd (patch)
tree816ad084f355000656c43da9160f1c257bbb1ddc /tveq_phantom_example.m
downloadl1magic-3983eb46023c1edd00617729ba929057fda8d0bd.tar.gz
l1magic-3983eb46023c1edd00617729ba929057fda8d0bd.zip
Initial import from https://statweb.stanford.edu/~candes/software/l1magic/v1.11
Additional Clean up of Mac dirs and tex generated files
Diffstat (limited to 'tveq_phantom_example.m')
-rw-r--r--tveq_phantom_example.m45
1 files changed, 45 insertions, 0 deletions
diff --git a/tveq_phantom_example.m b/tveq_phantom_example.m
new file mode 100644
index 0000000..0439a00
--- /dev/null
+++ b/tveq_phantom_example.m
@@ -0,0 +1,45 @@
+% tveq_phantom_example.m
+%
+% Phantom reconstruction from samples on 22 radial lines in the Fourier
+% plane.
+%
+% Written by: Justin Romberg, Caltech
+% Email: jrom@acm.caltech.edu
+% Created: October 2005
+%
+
+
+path(path, './Optimization');
+path(path, './Measurements');
+path(path, './Data');
+
+
+% Phantom
+n = 256;
+N = n*n;
+X = phantom(n);
+x = X(:);
+
+% number of radial lines in the Fourier domain
+L = 22;
+
+% Fourier samples we are given
+[M,Mh,mh,mhi] = LineMask(L,n);
+OMEGA = mhi;
+A = @(z) A_fhp(z, OMEGA);
+At = @(z) At_fhp(z, OMEGA, n);
+
+% measurements
+y = A(x);
+
+% min l2 reconstruction (backprojection)
+xbp = At(y);
+Xbp = reshape(xbp,n,n);
+
+% recovery
+tic
+tvI = sum(sum(sqrt([diff(X,1,2) zeros(n,1)].^2 + [diff(X,1,1); zeros(1,n)].^2 )));
+disp(sprintf('Original TV = %8.3f', tvI));
+xp = tveq_logbarrier(xbp, A, At, y, 1e-1, 2, 1e-8, 600);
+Xtv = reshape(xp, n, n);
+toc