- clear all;
- x=imread('H:lena.bmp');
- figure(1);
- subplot(121);
- imshow(x);
- Y=jpegencode(x,5);
- X=jpegdecode(Y);
- subplot(122);
- imshow(X);
- e=double(x)-double(X);
- [m,n]=size(e);
- erms=sqrt(sum(e(:).^2)/(m*n))
- ave=mean(x(:));
- x1=x.^2;
- cs1=sum(x1(:));
- x1=(x-X).^2;
- cd1=sum(x1(:));
- SNR=10*log10(cs1/cd1)
- % figure(1);imshow(X);
- %
- % localmax=imread('H:max.bmp');
- % Last=X+localmax;
- % figure(2);imshow(Last);