I have compressed and reconstructed an ECG signal using wavelet coefficients. In the compression part, many of wavelet coefficients are set to zero. For example, if in original ECG $5000$ wavelet coefficients have been obtained, now $4900$ coefficients have been set to zero. I have reconstructed the ECG signal using only $100$ coefficient, but how do I measure the compression ratio?

  • $\begingroup$ 1/50 seems right to me. $\endgroup$
    – msm
    Sep 11, 2016 at 22:35
  • $\begingroup$ Your question has beeen answered. Do not hesitate to vote for the useful ones and accept the most suitable $\endgroup$ Feb 9, 2017 at 17:17

2 Answers 2


You can get a crude wavelet "condensation" ratio of $100/5000 = 1/50$, but nothing more.

Indeed, you cannot get a compression ratio in that case, for several reasons. A stricto sensu compression ratio is given by the size of the compressed file divided by the file of the original file. But:

  • we do not have the size of the original file. Imagine it is a raw raster file, whose size is: (number of samples $\times$ precision) + header size. The number of samples could be of $5000$ samples, but there is no certainty. It could be due to redundant wavelets, edge extension. And we have no idea about the original precision. Suppose $16$-bit.
  • we do not have a compressed file. First, the nonzero wavelet coefficients could be coded on $32$-bit floats. Then, if the data is $16$-bit, the condensation ratio is doubled. Second, you do not know the location (time-scale index) of the kept coefficients. They should be coded too. Without them, if you send your $100$ coefficients to somebody, he would not be able to reconstruct the data. Even with the location, we don't have a compressed file, which generally included quantization, entropy coding, etc.

You can have better estimates using first- or second-order entropy of the coefficients, that can give you an estimate of the theoretical limit.


The compression ratio can be obtained by dividing the number of non-zero values in the output by the number of non-zero values in the input. Therefore, the smaller the resulting value the better.

  • $\begingroup$ I think the bigger value of compression ratio is better. by non-zero values in the output and non-zero values in the input, you mean non-zero values in the wavelet coefficient after thresholding and before that ? $\endgroup$
    – Hesam
    Jan 16, 2016 at 15:45
  • $\begingroup$ Well if I understand correctly what you're trying to achieve, you should take the number of non-zero values in the original signal and compare it with that in the signal after the wavelet transform. This will give you an indication to how much the signal was compressed. If you divide the number of non-zero values in the input by the ones in the output, the lower the value the more the signal is compressed. $\endgroup$
    – nevos
    Jan 17, 2016 at 9:58
  • $\begingroup$ That is a very crude estimate. You also have to take the information into account that is required to know which coefficients are non-zero. $\endgroup$
    – Jazzmaniac
    May 14, 2016 at 16:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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