标题: matlab中对图片进行压缩的处理 [打印本页]

作者: 叫我李敏镐    时间: 2017-10-7 20:57
标题: matlab中对图片进行压缩的处理
A=imread('aaa.tif');          I=rgb2gray(A);
trueImage=im2double(I);   %转换图像矩阵为双精度型
imshow(trueImage);          title('原始图像');
dctm=dctmtx(8);                  %计算离散余弦变换
imageDCT=blkproc(trueImage,[8 8],'P1*x*P2',dctm,dctm.');     
    %对图像I 的每个不同8*8数据块应用矩阵式’P1*x*P2’进行处理。
      M10=[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];   %二值掩模,用来压缩DCT 的系数
newImage2=blkproc(imageDCT,[8 8],'P1*(x.*P2)*P3',dctm',M10,dctm);
figure;
imshow(newImage2);         title('压缩图像 M10');


作者: Diana    时间: 2017-10-7 22:46
我们还没学到这里




欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1