How to implement sparse decoding after signal decompression
Afficher commentaires plus anciens
Hi all,
I am trying to do the compression and subsequent decompression of polysomnographic signals based on the Lempel-Ziv-Welch (LZW) algorithm. The pre-call step of the LZW algorithm is sparse encoding which I have implemented as follows and it seems to work. However, I don't know how to implement the sparse decoding after the subsequent decompression to compare it with the original signal.
%----------------------------COMPRESS--------------------------------
[...]
%Construct a dictionary consisting of the Daubechies' extremal-phase wavelet least-asymmetric
%wavelet with 4 vanishing moments at levels 1 and 4, the discrete cosine transform-II basis,
%and the sine basis.
dictionary= {{'db4',2},'dct','sin',{'sym4',1},{'sym4',4}};
[mpdict,nbvect]= wmpdictionary(length(originalSignal),'lstcpt',dictionary);
%SPARSE ENCODING
dictionarySparse= mpdict; %1) The dictionary created that contains the entry is saved
dictionaryFull= full(dictionarySparse); %2) The full dictionary is obtained. The sparse
% dictionary is changed to the full one
alpha= randi ([0,10000],1152,1);%3) A random vector of the same size as the
% dictionary matrix necessary to make the
% dictionary more manageable is created
dicVector = dictionaryFull*alpha; %4) The dictionary is multiplied by the previous vector and a
% vector of the size of the dictionary (256 values) is obtained
[...]
%----------------------------DECOMPRESS--------------------------------
%Call LZW algorithm function to decompress.
[lzwOutputd, lzwTabled] = lzw2norm(lzwOutput);
lzwOutputdTime=0:1:length(lzwOutputd)-1;
%To RESTORE COEFFICIENTS a change from uint8 to double to return to
%having the same data type as when beginning is made. They are then
%normalized by dividing by their norm.
S2 = im2double (lzwOutputd); %S2 = cast (lzwOutputd,'double');
CRestaurados = S2/norm(S2);
CR_final = CRestaurados';
%SPARSE DECODING: Obtain the dictionary containing the restored signal:
%an array of 256x1152 values. Do the inverse step to sparse encoding.
%--?--
%Reconstructed signal
%The 256 values of the signal obtained in the previous step and the time
%vector are stored within the same vector and file
reconstructedEOG = originalSignal_salida;
tempReconsEOG = lzwOutputdTime';
reconstructedEOG = [tempReconsEOG reconstructedEOG];
This is the flowchart that I follow in my implementation according to the literature

If anyone can guide me I would be very grateful.
Kind regards,
Réponse acceptée
Plus de réponses (1)
Alberto López Martínez
le 12 Avr 2024
0 votes
Catégories
En savoir plus sur Filter Design dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!