JPEG Compression with 8x8 DCT Block
Show older comments
Hi, i did this code to apply the jpeg compression to an image.
clc
clear all
close all
a=imread('coins.png');
figure(1)
imagesc(a)
xlabel('x')
ylabel('y')
title('a(x,y)')
colormap('gray')
colorbar
Atdc=dct2(a);
T=10;
Atdc(abs(Atdc)<T)=0;
Ac=idct2(Atdc);
figure (2)
imagesc(log10(abs(Atdc)+1))
xlabel('u')
ylabel('v')
colorbar
title('TDC')
K=rescale(Ac);
figure(3)
montage({a,K})
title('Original (left) and compressed (right')
But now I need to modify this code to apply an 8x8 DCT block, I suppose I have to change T for a matrix of ones, but I have no idea how to do this. I hope someone can help me, thanks.
Accepted Answer
More Answers (0)
Categories
Find more on Neighborhood and Block Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!