Highly Nonlinear Approximations for Sparse Signal Representation

Logo EPSRC

Elimination of random lines from an image

Download the MATLAB code for this example here.
% Removes random vertical lines from an image by projecting onto atoms chosen from a 
% spline wavelets dictionary using OOMPFinalRefi. 
% Construct the Spline Wavelet Dictionary 
sp = [0,32]; j = [0:2]; name = '4'; a = 2 ; b = 0.25; L = 513; 
[ mSplineWavelets, ind ] = GDictFast( name, {L;sp;j;a;b} );
mSplineWavelets(end,:) = [];
mImageLines = double( imread('lena_lines.tiff') );  % Import the image 
[y, x] = size( mImageLines );
rand( 'seed', 6 );
iLines = DetectLines(mImageLines);  % Detect the missing lines in the image 
szNoise = numel( iLines );
mEuclid = eye( x );
mLineSpace = mEuclid( :, iLines );  % Define the null space 
mOPNullPerp = eye(x) - OrthProj(mLineSpace);  % Construct the projector onto the Orthogonal complement of the null space 
mNullPerp = mOPNullPerp*mSplineWavelets;  % Construct the Orthogonal Complement of the null space 
for i = 1:y
    vLineProjected = mOPNullPerp*mImageLines(i,:)';  % Project the line 
    tol = 0.01*norm(vLineProjected);
    [ DS0, Di0, beta0, c0, Q0 ] = OOMPFinalRefi( vLineProjected', mNullPerp, tol, 201 );  % Find the sparse represention of vLineProjected 
    nCn = numel(c0);
    mImageProjected(i,:) = mSplineWavelets(:,Di0(1:nCn))*c0';  % Reconstruct the line 
end

Figure: The image of Lena with random vertical lines (left), the filtered image (right).
Image lena_lines Image lena_projected