10 DCT变换对灰度图像压缩matlab案例
%% DCT图像压缩matlab
%----------------------------------------------------------
clear all
clc
k=4;
X=imread(‘girl.bmp’); %打开图像
A=double(X); %将图像转换成double型
B=zeros(size(A));
C=zeros(size(A));
%----------------------------------------------------------
%% 作二维DCT,每一小块为 8×8;
%----------------------------------------------------------
……
……
……
(省略部分代码,完整代码可以下载)
……
……
……
%----------------------------------------------------------
%% 逆DCT,图象重建
%----------------------------------------------------------
for m=1:128
if rem(m,8)==0
for n=1:128
if rem(n,8)==0
C((m-8+1):m,(n-8+1):n)=idct2(B((m-8+1):m,(n-8+1):n));
end
end
end
end
%----------------------------------------------------------
%% 输出二维图像;
%----------------------------------------------------------
C=uint8©;
subplot(1,2,1);
subimage(X);
axis square;xlabel(‘原图像’)
subplot(1,2,2);
subimage©;
axis square;xlabel(‘压缩图像’);
……
……
……
(省略部分代码,完整代码可以下载)
……
……
……
……
……
……
(省略部分代码,完整代码可以下载)
……
……
……
10 DCT变换对灰度图像压缩案例matlab程序.zip-****下载 https://download.****.net/download/weixin_44356700/11852104
新上线了一门视频课程——二十八课时精通matlab图像技术-在线****-****学院 https://edu.****.net/course/detail/25004