matlab DCT变换function DCTclear;close all;a=imread('A1.jpg');subplot(121);imshow(a);title('原图');a=double(a);[M,N]=size(a);%获取图像大小b=0:(N-1);c=b;d=b'*c; %获取N乘N矩阵W=pi/(2*N);for x=1:Nfor y=2:Nd(x,y)=cos((2*(x-1)+1)*(y-1)*W);%
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/16 03:26:40
matlab DCT变换function DCTclear;close all;a=imread('A1.jpg');subplot(121);imshow(a);title('原图');a=double(a);[M,N]=size(a);%获取图像大小b=0:(N-1);c=b;d=b'*c; %获取N乘N矩阵W=pi/(2*N);for x=1:Nfor y=2:Nd(x,y)=cos((2*(x-1)+1)*(y-1)*W);%
matlab DCT变换
function DCT
clear;
close all;
a=imread('A1.jpg');
subplot(121);
imshow(a);
title('原图');
a=double(a);
[M,N]=size(a);%获取图像大小
b=0:(N-1);
c=b;
d=b'*c; %获取N乘N矩阵
W=pi/(2*N);
for x=1:N
for y=2:N
d(x,y)=cos((2*(x-1)+1)*(y-1)*W);%当不出现有零的行或者列时的DCT变换核
end
end
for x=1:N;
d(x,1)=(1/sqrt(2))*cos((2*(x-1)+1)*(y-1)*W);%出现零列或者行时的DCT变换核
end
a1=a*d;%第一次变换
a2=(2/N)*d'*a1;%第二次变换
subplot(122);
imshow(a2);
title('DCT变换后图像');
22行错?
matlab DCT变换function DCTclear;close all;a=imread('A1.jpg');subplot(121);imshow(a);title('原图');a=double(a);[M,N]=size(a);%获取图像大小b=0:(N-1);c=b;d=b'*c; %获取N乘N矩阵W=pi/(2*N);for x=1:Nfor y=2:Nd(x,y)=cos((2*(x-1)+1)*(y-1)*W);%
你直接说哪行错误,指清楚点,matlab 中的22行和现在的22行不一样