请分析改程序显示图的含义。
先读取图片,然后取出x=177:203, y=424:444之间的图片,在求原图和a的相关性,然后檫黑
2. 离散余弦变换(DCT)
A) 使用dct2对图像‘autumn.tif’进行DCT变换。 RGB=imread('autumn.tif'); imshow(RGB)
I=rgb2gray(RGB); %转换为灰度图像 figure,imshow(I)
J=dct2(I);
figure,imshow(log(abs(J)),[]),colormap(jet(64));colorbar;
B) 将上述DCT变换结果中绝对值小于10的系数舍弃,使用idct2重构图像并与原图
像比较。 RGB=imread('autumn.tif'); I=rgb2gray(RGB); %转换为灰度图像 J=dct2(I);
figure,imshow(I)
K=idct2(J);
figure,imshow(K,[0 255])
J(abs(J)<10)=0;
%舍弃系数
K2=idct2(J);
figure,imshow(K2,[0 255])
C) 利用DCT变换进行图像压缩。 I=imread('cameraman.tif'); I=im2double(I); T=dctmtx(8);
B=blkproc(I,[8,8],'P1*x*P2',T,T'); mask=[1 1 1 1 0 0 0 0 1 1 1 0 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; B2=blkproc(B,[8 8],'P1.*x',mask); I2=blkproc(B2,[8 8],'P1*x*P2',T',T); imshow(I)