图像质量评价:合成失真图像方法
图像质量评价:合成失真图像方法
1、高斯噪声
代码
%%高斯噪声
a=imread('monarch.bmp');
subplot(2,3,1);
imshow(a);
title ('原始图像');
Inoise1=imnoise(a,'gaussian',0.1,0.01);%对图像加入高斯噪声1
subplot(2,3,2);
imshow(Inoise1);
title('加入高斯噪声1');
Inoise2=imnoise(a,'gaussian',0.2,0.01);%对图像加入高斯噪声2
subplot(2,3,3);
imshow(Inoise2);
title('加入高斯噪声2');
Inoise3=imnoise(a,'gaussian',0.1,0.05);%对图像加入高斯噪声4
subplot(2,3,4);
imshow(Inoise3);
title('加入高斯噪声3');
Inoise4=imnoise(a,'gaussian',0.2,0.09);%对图像加入高斯噪声5
subplot(2,3,5);
imshow(Inoise4);
title('加入高斯噪声4');
Inoise5=imnoise(a,'gaussian',0.5,0.01);%对图像加入高斯噪声3
subplot(2,3,6);
imshow(Inoise5);
title('加入高斯噪声6');
2、运动模糊
代码
%%运动模糊
a=imread('monarch.bmp');
subplot(2,3,1);
imshow(a);
title ('原始图像');
PSF1=fspecial('motion',10,10);
blurred=imfilter(a,PSF1,'circular','conv');
subplot(2,3,2),imshow(blurred),title('运动模糊1')
PSF2=fspecial('motion',20,5);
blurred=imfilter(a,PSF2,'circular','conv');
subplot(2,3,3),imshow(blurred),title('运动模糊2')
PSF3=fspecial('motion',30,20);
blurred=imfilter(a,PSF3,'circular','conv');
subplot(2,3,4),imshow(blurred),title('运动模糊3')
PSF4=fspecial('motion',30,50);
blurred=imfilter(a,PSF4,'circular','conv');
subplot(2,3,5),imshow(blurred),title('运动模糊4')
PSF5=fspecial('motion',40,50);
blurred=imfilter(a,PSF5,'circular','conv');
subplot(2,3,6),imshow(blurred),title('运动模糊5')
3、高斯模糊
代码
a=imread('monarch.bmp');
subplot(2,3,1);
imshow(a);
title ('原始图像');
G1=fspecial('gaussian',10,10);
gaus1=imfilter(a,G1);
subplot(2,3,2),imshow(gaus1),title('高斯模糊1')
G2=fspecial('gaussian',20,10);
gaus2=imfilter(a,G2);
subplot(2,3,4),imshow(gaus2),title('高斯模糊3')
G3=fspecial('gaussian',10,20);
gaus3=imfilter(a,G3);
subplot(2,3,3),imshow(gaus3),title('高斯模糊2')
G4=fspecial('gaussian',30,10);
gaus4=imfilter(a,G4);
subplot(2,3,5),imshow(gaus4),title('高斯模糊4')
G5=fspecial('gaussian',30,20);
gaus5=imfilter(a,G5);
subplot(2,3,6),imshow(gaus5),title('高斯模糊5')
4、椒盐噪声
代码
%%椒盐噪声
a=imread('monarch.bmp');
subplot(2,3,1);
imshow(a);
title ('原始图像');
J1=imnoise(a,'salt & pepper',0.01);
subplot(2,3,2),imshow(J1),title('椒盐噪声1');
J2=imnoise(a,'salt & pepper',0.02);
subplot(2,3,3),imshow(J2),title('椒盐噪声2');
J3=imnoise(a,'salt & pepper',0.05);
subplot(2,3,4),imshow(J3),title('椒盐噪声3');
J4=imnoise(a,'salt & pepper',0.1);
subplot(2,3,5),imshow(J4),title('椒盐噪声4');
J5=imnoise(a,'salt & pepper',0.3);
subplot(2,3,6),imshow(J5),title('椒盐噪声5');
5、均值滤波
代码
%%平均值滤波
a=imread('monarch.bmp');
subplot(2,3,1);
imshow(a);
title ('原始图像');
h1 = fspecial('average',5);
hblur1=imfilter(a,h1);
subplot(2,3,2),imshow(hblur1),title('平均值滤波1')
h2 = fspecial('average',8);
hblur2=imfilter(a,h2);
subplot(2,3,3),imshow(hblur2),title('平均值滤波2')
h3 = fspecial('average',10);
hblur3=imfilter(a,h3);
subplot(2,3,4),imshow(hblur3),title('平均值滤波3')
h4 = fspecial('average',15);
hblur4=imfilter(a,h4);
subplot(2,3,5),imshow(hblur4),title('平均值滤波4')
h5 = fspecial('average',20);
hblur5=imfilter(a,h5);
subplot(2,3,6),imshow(hblur5),title('平均值滤波5')
6、圆形滤波
代码
%%圆形滤波
a=imread('monarch.bmp');
subplot(2,3,1);
imshow(a);
title ('原始图像');
blur1=fspecial('disk',5);
averageblur1=imfilter(a,blur1,'replicate');
subplot(2,3,2),imshow(averageblur1),title('圆形滤波器模糊1')
blur2=fspecial('disk',8);
averageblur2=imfilter(a,blur2,'replicate');
subplot(2,3,3),imshow(averageblur2),title('圆形滤波器模糊2')
blur3=fspecial('disk',10);
averageblur3=imfilter(a,blur3,'replicate');
subplot(2,3,4),imshow(averageblur3),title('圆形滤波器模糊3')
blur4=fspecial('disk',15);
averageblur4=imfilter(a,blur4,'replicate');
subplot(2,3,5),imshow(averageblur4),title('圆形滤波器模糊4')
blur5=fspecial('disk',18);
averageblur5=imfilter(a,blur5,'replicate');
subplot(2,3,6),imshow(averageblur5),title('圆形滤波器模糊5')
7、JPEG压缩
代码
%%圆形滤波
a=imread('monarch.bmp');
subplot(2,3,1);
imshow(a);
title ('原始图像');
imwrite(I,'monarch1.jpeg','Quality',20);
hblur=imread('monarch1.jpeg');
subplot(2,3,2),imshow(hblur),title('jpeg压缩1');
imwrite(I,'monarch2.jpeg','Quality',15);
hblur2=imread('monarch2.jpeg');
subplot(2,3,3),imshow(hblur2),title('jpeg压缩2')
imwrite(I,'monarch3.jpeg','Quality',10);
hblur3=imread('monarch2.jpeg');
subplot(2,3,4),imshow(hblur3),title('jpeg压缩3')
imwrite(I,'monarch4.jpeg','Quality',5);
hblur4=imread('monarch4.jpeg');
subplot(2,3,5),imshow(hblur4),title('jpeg压缩4')
imwrite(I,'monarch5.jpeg','Quality',1);
hblur5=imread('monarch5.jpeg');
subplot(2,3,6),imshow(hblur5),title('jpeg压缩5')
8、JPEG2000压缩
代码
%%圆形滤波
a=imread('monarch.bmp');
subplot(2,3,1);
imshow(a);
title ('原始图像');
imwrite(I,'monarch1.jp2','CompressionRatio',50);
hblur=imread('monarch1.jp2');
subplot(2,3,2),imshow(hblur),title('jpeg2000压缩1');
imwrite(I,'monarch2.jp2','CompressionRatio',100);
hblur2=imread('monarch2.jp2');
subplot(2,3,3),imshow(hblur2),title('jpeg2000压缩2')
imwrite(I,'monarch3.jp2','CompressionRatio',200);
hblur3=imread('monarch2.jp2');
subplot(2,3,4),imshow(hblur3),title('jpeg2000压缩3')
imwrite(I,'monarch4.jp2','CompressionRatio',400);
hblur4=imread('monarch4.jp2');
subplot(2,3,5),imshow(hblur4),title('jpeg2000压缩4')
imwrite(I,'monarch5.jp2','CompressionRatio',800);
hblur5=imread('monarch5.jp2');
subplot(2,3,6),imshow(hblur5),title('jpeg2000压缩5')
9、乘性噪声
代码
a=imread('monarch.bmp');
subplot(2,3,1);
imshow(a);
title ('原始图像');
Inoise1=imnoise(a,'speckle',0.1);
subplot(2,3,2);
imshow(Inoise1);
title('加入乘性噪声1');
Inoise2=imnoise(a,'speckle',0.2);
subplot(2,3,3);
imshow(Inoise2);
title('加入乘性噪声2');
Inoise3=imnoise(a,'speckle',0.1);
subplot(2,3,4);
imshow(Inoise3);
title('加入乘性噪声3');
Inoise4=imnoise(a,'speckle',0.2);
subplot(2,3,5);
imshow(Inoise4);
title('加入乘性噪声4');
Inoise5=imnoise(a,'speckle',0.5);
subplot(2,3,6);
imshow(Inoise5);
title('加入乘性噪声6');