image compression using FFT

15 次查看(过去 30 天)
Sir how can we compress image using FFT transform..RLE coding is not suitable with the FFT..what coding technique is suitable for FFT to compress the image..

回答(2 个)

Walter Roberson
Walter Roberson 2014-4-3
RLE is a lossless compression technique. Compression with FFT is a lossy compression technique. You do the FFT, and you throw away some of the coefficients and output the rest; then for reconstruction you let the missing coefficients be 0 and do the inverse FFT.
Which coefficients you should throw away is something for you to explore.

sam k
sam k 2020-6-6
a=imread('link.jpeg');
grayIm =rgb2gray(a);
[row col] = size(grayIm);
subplot(2, 2, 1);
imshow(grayIm);
title('original image')
A=fft2(grayIm); %2D fft
count_pic=2;
for thresh=0.1*[0.001 0.005 0.006]*max(max(abs(A)))
ind=abs(A)>thresh;
count=row*col-sum(sum(ind));
Alow=A.*ind;
per=100-count/(row*col)*100;
Blow=uint8(ifft2(Alow));
subplot(2,2,count_pic);
imshow(Blow);
count_pic=count_pic+1;
title([num2str(per) '% of fft basis'])
end
  2 个评论
Thinh
Thinh 2022-10-26
can you explain this, please
Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023-11-15
This means what % of the highest FFT coeffcients to keep.
It can be also applied for color (RGB) images as well:
A = imread('A1.jpeg');
Afft=fft2(A);
Asort = sort(abs(Afft(:)));
counter=0;
for Keep = [.95 .1 .05 .001]
threshold = Asort(floor((1-Keep)*length(Asort)));
Ind = abs(Afft)>threshold;
Atlow = Afft.*Ind;
Alow = uint8(ifft2(Atlow));
s = whos('Alow');
totSize = s.bytes;
counter=counter+1;
figure(counter)
imshow(Alow)
saveas(gcf, strcat(['FFT_IMG', num2str(counter) '.jpeg']))
s = dir(strcat(['FFT_IMG', num2str(counter) '.jpeg']));
filesize(counter)=s.bytes
title([num2str(Keep) '% of fft basis is kept and updated image file size is: ' num2str(s.bytes)])
end

请先登录,再进行评论。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by