📄 jpeg.m
字号:
clear
I=imread('bahuan.jpg');
I=rgb2gray(I);
I=im2double(I);
T=dctmtx(8);
B1=blkproc(I,[8 8],'P1*x*P2',T,T');
B1=B1/0.01;
B1=round(B1);
B1=B1*0.01;
I1=blkproc(B1,[8 8],'P1*x*P2',T',T);
B3=blkproc(I,[8 8],'P1*x*P2',T,T');
mask=[1 1 1 1 1 0 0 0
1 1 1 1 1 0 0 0
1 1 1 1 1 0 0 0
1 1 1 1 1 0 0 0
1 1 1 1 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];
B3=blkproc(B3,[8 8],'P1.*x',mask);
B3=B3./0.1;
B3=round(B3);
B3=B3*0.1;
I3=blkproc(B3,[8 8],'P1*x*P2',T',T);
figure(1);
imshow(I1);
title('VBS=8');
figure(3);
imshow(I3);
title('VBS=5');
%************************************************************
clear;
I=imread('bahuan.jpg');
I=rgb2gray(I);
I=im2double(I);
T=dctmtx(8);
B=blkproc(I,[8 8],'P1*x*P2',T,T');
%B=blkproc(I,[8 8],'DCT2(x)');
B1=B*1000/25;
B1=round(B1);
B1=B1*25/1000;
I1=blkproc(B1,[8 8],'P1*x*P2',T',T);
B2=B*1000/50;
B2=round(B2);
B2=B2*50/1000;
I2=blkproc(B2,[8 8],'P1*x*P2',T',T);
B3=B*1000/75;
B3=round(B3);
B3=B3/1000*75;
I3=blkproc(B3,[8 8],'P1*x*P2',T',T);
figure(1);
imshow(I1);
title('QL=25');
figure(2)
imshow(I2);
title('QL=50');
figure(3)
imshow(I3);
title('QL=75');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -