image compression using FFT
조회 수: 19 (최근 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..
댓글 수: 0
답변 (2개)
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.
댓글 수: 0
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
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Denoising and Compression에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!