资源简介
基于大气模型的Tarel单幅图像去雾算法的MATLAB代码,已经上机操作代码可以跑通。
代码片段和文件信息
%
% 17/11/2009
% Author: J.-P. Tarel
% LCPC-INRETS-IFSTTAR copyright
% completed and corrected in 18/08/2010 and in 29/09/2010
%
% This algorithm is described in details in
%
% “Fast Visibility Restoration from a Single Color or Gray Level Image“
% by J.-P. Tarel and N. Hautiere
% in proceedings of IEEE International Conference on Computer Vision (ICCV‘09)
% Kyoto Japan p. 2201-2208 September 29- October 2 2009.
% http://perso.lcpc.fr/tarel.jean-philippe/publis/iccv09.html
%
% extra explainations can be also found in
%
%“Improved Visibility of Road Scene Images under Heterogeneous Fog“
% by J.-P. Tarel N. Hautiere A. Cord D. Gruyer and H. Halmaoui
% in proceedings of IEEE Intelligent Vehicles Symposium (IV‘10)
% San Diego California USA p. 478-485 June 21-24 2010.
% http://perso.lcpc.fr/tarel.jean-philippe/publis/iv10.html
%
% Beware that slight differences in the obtained results can be observed
% between the original fast C code and this matlab implementation
%
% INPUTS:
% orig is the original image in double between O and 1
% p is the percentage of restoration
% sv is the maximum size of assumed white objects
% balance is negative for no white balance
% balance is 0.0 for global white balance
% balance is higher 0.0 for local white balance:
% balance=0.1 leads to a strong bias towards (111)
% balance=0.5 can be used as a good starting value
% balance=1.0 remove most of the colors
% smax is the maximum window size for the the adapted filtering
% when smax is 1 no adpated filtering is performed
% smax can be used for very noisy original images
% gfactor is an extra factor during final gamma correction to achieve
% more colorful result
%
%
% OUTPUT:
% resto is the obtained image after visibility restoration
%
function resto=visibresto(orig sv p balance smax gfactor)
% default parameters
if (nargin < 6)
gfactor=1.3; % default value for extra factor during final gamma correction
end
if (nargin < 5)
smax=1; % by default no adapted filtering
end
if (nargin < 4)
balance=-1.0; % by default no white balance
end
if (nargin < 3)
p = 0.95; % by default percentage of restoration in 95%
end
if (nargin < 2)
sv = 11; % by default white objects are assumed with size sv=11
end
if (nargin < 1)
msg1 = sprintf(‘%s: Not input.‘ upper(mfilename));
eid = sprintf(‘%s:NoInputArgument‘mfilename);
error(eid‘%s %s‘msg1);
end
% test input arguments
smax=floor(smax);
if (smax < 1)
msg1 = sprintf(‘%s: smax is out of bound.‘ upper(mfilename));
msg2 = ‘It must be an integer higher or equal to 1.‘;
eid = sprintf(‘%s:outOfRangeSMAx‘mfilename);
error(eid‘%s %s‘msg1msg2);
end
if ((p >= 1.0) | (p<=0.0))
msg1 = sprintf(‘%s: p is out of bound.‘ upper(mfilename));
msg2 = ‘It must be an between 0.0 and 1.0‘;
eid = sprintf(‘%s:outOfRangeP‘mfilename);
error(eid‘%s %s‘msg1msg2);
end
sv=floor(sv);
i
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2013-03-08 15:49 Tarel-visibresto2
文件 6665 2013-03-06 19:50 Tarel-visibresto2\nbpc.m
文件 7449 2013-03-08 15:49 Tarel-visibresto2\nbpcpa.m
文件 110632 2010-09-29 15:57 Tarel-visibresto2\PISTEB00738S.pgm
文件 649 2013-03-08 15:48 Tarel-visibresto2\run_examples.m
文件 179324 2010-09-29 18:33 Tarel-visibresto2\sweden.jpg
- 上一篇:高斯正反算批量计算
- 下一篇:摆动滚子推杆盘形凸轮设计
评论
共有 条评论