0
$\begingroup$

I want to use compressive sensing to reconstruct an image from fewer samples. My problem is with Psi matrix which I want to be Biorthogonal wavelet coefficients but I don't know how to define it. I have used Fourier basis and Haar wavelet and it worked well. Here is my code with Haar wavelet.

Can anyone tell me how to define Psi matrix as Biorthogonal wavelet transform? Thanks in advance.

 clc
close all
clear all

[fn,fp]=uigetfile({'*.*'});

A=im2double(rgb2gray(imread([fp,fn])));
figure(1),imshow(A)
xlabel('original')

x=A(:);
n=length(x);

m=0.3*n;
Phi=randn(m,n);   %Measurment Matrix
Psi=generate_haar(n);   %sensing Matrix which is made by generate_haar function

y=Phi*x;  %compressed signal
Theta=Phi*Psi;

%Initial Guess:  y=Theta*s => s=Theta\y

s2=Theta\y;

%Solution
s1=OMP( Theta, y, 1e-3);

%Reconstruction
x1=Psi*s1;
figure,imshow(reshape(x1,size(A))),xlabel('OMP')
$\endgroup$
0
$\begingroup$

You don't have to define the matrix explicitly and in general it is a bad idea to do so. For instance, the matrix implementation of the DFT will be an order of magnitude slower than the FFT implementation. Instead, what one usually does is use a function handle. Using the DFT as an example, since the adjoint of the operator is the inverse DFT, the function would look something like

function y = fftop( x, adj )
  if( adj == 0 )
    y = fft( x );
  else
    y = ifft( x );
  end

The solver should (and all that I have ever seen do) take a function handle for the linear operator as well as an explicit matrix. (The explicit matrix is then converted into a function handle within the solver.) For instance, look at the documentation for lsqr. How it will exactly look will all depend on the software you use, but it will be something along the lines of

x = array_of_measurements;
f = @(q,adj) fftop(q,adj);
z = my_solver( x, f );

As for the wavelet transform, if the adjoint is the inverse, then construct a function similar to the above and avoid creating the matrix representation of the operator altogether.

$\endgroup$
  • $\begingroup$ Thanks, I know what do you mean, but anyway I need to make biorthogonal matrix as phi matrix in CS. in this case, I have a problem to make the h and g (high pass and low pass filter response) to put in the biorthogonal matrix function.the process of making matrix function of biorthogonal is not clear to me. $\endgroup$ – Neda Apr 23 '18 at 7:31
  • $\begingroup$ If you insist on forming the matrix explicitly, then you can apply the operation to an identity matrix. For instance, one way to construct the DFT matrix is fft(eye(N));. $\endgroup$ – AnonSubmitter85 Apr 23 '18 at 15:35
  • $\begingroup$ Thanks so much, I have written code for DFT or FFT and also for Haar wavelet. their results were so good. But my problem is for another type of wavelet. $\endgroup$ – Neda Apr 24 '18 at 10:19
  • $\begingroup$ @Neda Are you just looking for code that performs the biorthogonal wavelet transform? $\endgroup$ – AnonSubmitter85 Apr 24 '18 at 14:41
  • $\begingroup$ yes, I need the portion of the code which generates the matrix. $\endgroup$ – Neda Apr 26 '18 at 7:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.