image compression using FFT

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..

Risposte (2)

Walter Roberson
Walter Roberson il 3 Apr 2014

0 voti

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 il 6 Giu 2020
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 Commenti

Thinh
Thinh il 26 Ott 2022
can you explain this, please
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

Accedi per commentare.

Categorie

Community Treasure Hunt

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

Start Hunting!

Translated by