A program in the matlab, DCT inverse transformation, the reconstructed image is what you will be presented with horizontal stripes? , every brother please!
Program listing:
Filename="D:/Program Files/MATLAB/R2016b/bin/tuxiangshiyan/Lena img ';
Data=https://bbs.csdn.net/topics/img_display (filename);
The parameters (data);
Cal_PSNR (data);
Function [data]=img_display (filename) % display images program
Fid=fopen (filename, 'r');
Data=https://bbs.csdn.net/topics/(fread (fid, [256256], 'uint8))';
Imagesc (data, [0] 255);
Colormap (gray);
The axis image
End
The function parameters (data) % calculation parameters
[M, N]=size (data) % image size
Data=https://bbs.csdn.net/topics/uint8 (data);
Ave=mean (mean (data)) % grayscale average
G=imnoise (data, 'salt & amp; Pepper ', 0.05);
Imagesc (g, [0] 255);
Colormap (gray);
The axis image
Ave2=mean (mean (g));
I=(data - ave). * (g - ave2);
I2=data - (ave). * (data - ave);
Cfg=mean (mean (I)) % covariance value
Cff=mean (mean (I2)) % image variance
SD=SQRT (Cff) % gray standard deviation
Cgg=scheme (the scheme ((g - ave2). * (g - ave2)));
RFG=Cfg/SQRT (Cff * Cgg) % correlation coefficient
End
The function cal_PSNR (data)
[M, N]=size (data);
T=DCTMTX (4);
Data1=im2double (data);
B=blkproc (data1, 4 [4], 'P1 P2 * x *, T, T');
Mask=[1 1 1 1
1 1 1 0
1 0 0 0
0 0 0 0];
B2=blkproc (B, 4 [4], 'P1. * x, mask);
Data2=blkproc (B2, 4 [4], 'P1. * x * P2' T ', T);
figure(2);
% imshow (data2);
Imagesc (data2);
Colormap (gray);
The axis image
PSNR=10 * log10 ((M * N * (255 ^ 2))/sum (the sum (data2 - data1)))
End