Search code examples
imagematlabcompressionfftimage-compression

Compression Ratio of an image using matlab


I was trying to calculate the CR(compressing ratio) of an image that I compressed and decompressed using FFT in matlab. I have read a similar post here about CR calculation but I did not get the method he was using to process the image. That post was saying that : CR = numel(X)/numel(Y) What I understood is that X is my image before FFT and Y is after. So I said that

I=imread('flowers.tif')
RGB = im2double(I);
%process...
iRGB = my reconstructed image after iFFT
CR = numel(RGB)/numel(iRGB);

But this results in CR =1 which I do not think that is the correct answer. Can someone explain to me what am I missing?


Solution

  • The compression rate is the ratio of numel of the compressed representation and the un-compressed one. Your iRGB is a reconstructed representation and therefore has the same number of elements as RGB (you need to reconstruct the entire image). For the CR you need the numel of your compressed representation.