MATLAB影象清晰度評價
阿新 • • 發佈:2019-01-30
clear all;
G=zeros(1,60);
j=1;
for i=1:60
I=imread(['D:\MATLAB\bin\do\',int2str(i),'.jpg']);
I=rgb2gray(I);
[m,n]=size(I);
I=double(I);
f=0.0;
m2=(m-1)*4/5;
n2=(n-1)*4/5;
for x=1:m2
for y=1:n2
Gx=I(x+1,y)-I(x,y);
Gy=I(x,y+1)-I(x,y);
f=f+abs(Gx)+abs(Gy);
end
end
G(1,j)=f;
j=j+1;
end
a=0.0;
for i=1:60
if (a<G(i))
a=G(i);b=i;
end
end
qxdMAX=a
num=b
img=imread(['D:\MATLAB\bin\do\',int2str(num),'.jpg']);
figure
imshow(img)
figure
plot(G)
title('清晰度評價');
xlabel('圖片數');
G=zeros(1,60);
j=1;
for i=1:60
I=imread(['D:\MATLAB\bin\do\',int2str(i),'.jpg']);
I=rgb2gray(I);
[m,n]=size(I);
I=double(I);
f=0.0;
m2=(m-1)*4/5;
n2=(n-1)*4/5;
for x=1:m2
for y=1:n2
Gx=I(x+1,y)-I(x,y);
Gy=I(x,y+1)-I(x,y);
f=f+abs(Gx)+abs(Gy);
end
end
G(1,j)=f;
j=j+1;
end
a=0.0;
for i=1:60
if (a<G(i))
a=G(i);b=i;
end
end
qxdMAX=a
num=b
img=imread(['D:\MATLAB\bin\do\',int2str(num),'.jpg']);
figure
imshow(img)
figure
plot(G)
title('清晰度評價');
xlabel('圖片數');
ylabel('圖片清晰度');