exFFT.m
上传用户:hwtw888
上传日期:2016-03-15
资源大小:177k
文件大小:1k
- %设置压缩比cr
- cr = 0.5;
- %读入并显示原始图像
- I1 = imread('lena512.bmp');
- figure(1);
- imshow(I1);
- %对图像进行FFT
- I1 = double(I1);
- fftcoe = blkproc(I1, [8 8], 'fft2(x)');
- coevar = im2col(fftcoe, [8 8], 'distinct');
- coe = coevar;
- [y, ind] = sort(coevar);
- [m, n] = size(coevar);
- snum = 64 - 64*cr;
- %舍去不重要的系数
- for i = 1: n
- coe(ind(1: snum), i) = 0;
- end
- B2 = col2im(coe, [8 8], [512 512], 'distinct');
- %对子图像块进行IFFT获得各个子图像的复原图像,并显示压缩图像
- I2 = blkproc(B2, [8 8], 'ifft2(x)');
- figure(2);
- imshow(I2, [ ]);
- %计算圴方误差
- %erms = erms(I1, I2)
- e = double(I1) - double(I2);
- [m, n] = size(e);
- ERMS = sqrt(sum(e(:).^2)/(m*n))