-
大小: 1.21MB文件类型: .zip金币: 1下载: 0 次发布日期: 2023-10-01
- 语言: 其他
- 标签:
资源简介
用于自然图像去雾算法的质量评价算法,目前去雾评价中应用最多的一种算法,来源于文章“Blind contrast enhancement assessment by gradient ratioing at visible edges”
代码片段和文件信息
% 23/02/2011
% IFSTTAR copyright
%
% The approach is described in details in
%
% “Blind Contrast Restoration Assessment by Gradient Ratioing at Visible Edges“
% by N. Hautiere J.-P. Tarel D. Aubert and E. Dumont
% in proceedings of International Congress for Stereology (ICS‘07)
% Saint Etienne France August 30-September 7 2007.
% http://perso.lcpc.fr/tarel.jean-philippe/publis/ics07.html
%
%%%% Cleaning
clc
clear all
close all
%%%% Images reading: the input 2 images must be grayscale
NameOri=‘Original.pgm‘;
NameResto=‘Restored.pgm‘;
%NameResto=‘Restored2.pgm‘;
%NameResto=‘Restored3.pgm‘;
%NameResto=‘Restored4.pgm‘;
%NameResto=‘Restored5.pgm‘;
I1=Imread(NameOri);
I1=double(I1);
% if the input image is a color image use following line
% I1=double(rgb2gray(uint8(I1)));
[nlnc]=size(I1);
R1=Imread(NameResto);
R1=double(R1);
% if the input image is a color image use following line
% R1=double(rgb2gray(uint8(R1)));
%%%% Figure 1
figure(1)
colormap gray
subplot(121)
imagesc(I1)
axis image
title(‘Original‘)
subplot(122)
imagesc(R1)
axis image
title(‘Restored‘)
%%%% Sobel Gradient
Sy = double([1 2 1;0 0 0;-1 -2 -1]);
GIy = imfilter(I1Sy‘symmetric‘);
GRy1 = imfilter(R1Sy‘symmetric‘);
Sx = double([1 0 -1; 2 0 -2; 1 0 -1]);
GIx = imfilter(I1Sx‘symmetric‘);
GRx1 = imfilter(R1Sx‘symmetric‘);
GI=sqrt((GIx.^2)+(GIy.^2));
GR1=sqrt((GRx1.^2)+(GRy1.^2));
minGI=min(GI(:));
maxGI=max(GI(:));
%%%% Figure 2
figure(2)
colormap gray
subplot(121)
imagesc(GI[minGI maxGI]);
title([‘Gradients of the original image‘]);
axis image
colorbar
subplot(122)
imagesc(GR1[minGI maxGI]);
title([‘Gradients of the restored image‘]);
axis image
colorbar
%%%% Contrast Computation at 5%
tic
[C1 Crr1]=functionContrastAt5PerCent(R1);
[Ci Crri]=functionContrastAt5PerCent(I1);
toc
minCrri=min(Crri(:));
maxCrri=max(Crri(:));
%%%% Figure 3
figure(3)
colormap gray
subplot(121)
imagesc(Crri[minCrri maxCrri]);
axis image
title([‘Visible edge in the original image‘]);
colorbar
subplot(122)
imagesc(Crr1[minCrri maxCrri]);
axis image
title([‘Visible edge in the restored image‘]);
colorbar
%%%% Visible Gradients Ratio
Cratio1=zeros(nlnc);
Cratio1(Crr1>0)=GR1(Crr1>0)./GI(Crr1>0);
rmin=1;
rmax=10;
%%%% Figure 4
figure(4)
imagesc(Cratio1[rmin rmax]);
axis image
title([‘Visible gradients ratio between ‘num2str(rmin) ‘ and ‘num2str(rmax)]);
colormap jet
colorbar
%%%% Descriptor computation
% Rate of new visible edges
whitePixels1=sum(C1(:));
whitePixelsi=sum(Ci(:));
e1=(whitePixels1-whitePixelsi)/whitePixelsi;
% Number of saturated pixels after restoration
ns1=sum(R1(:)==256 |R1(:)==0);
ns1=ns1/(nl*nc);
% Restoration quality (geometric mean ratios of visibility level)
XX=log(Cratio1);
r1=exp((1/(whitePixels1))*nansum(XX(isfinite(XX))));
%%%% Figure 5: Final result with the visible edges at 5% and descriptors
figure(5)
subplot(12
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3413 2011-02-23 15:10 EvaluationDesc
文件 5335 2011-02-23 15:11 EvaluationDesc
文件 437775 2010-02-11 14:58 EvaluationDesc
文件 437775 2010-03-04 16:43 EvaluationDesc
文件 437775 2010-03-04 16:44 EvaluationDesc
文件 437775 2010-03-04 16:44 EvaluationDesc
文件 437775 2010-03-04 16:44 EvaluationDesc
文件 437775 2010-03-07 22:29 EvaluationDesc
- 上一篇:EMS dea
- 下一篇:超市销售管理系统,毕业设计
评论
共有 条评论