Professional Documents
Culture Documents
PRIOR ALGORITHM
S. MAHALAKSHMI 19ML05
R. KEERTHANA 19ML33
DEHAZING OF IMAGES
The presence of haze in the atmosphere degrades the quality of images captured by
visible camera sensors. The removal of haze, called dehazing, is typically performed under the
physical degradation model, which necessitates a solution of an ill-posed inverse problem. To
relieve the difficulty of the inverse problem, a novel prior called dark channel prior (DCP) was
recently proposed and has received a great deal of attention. The DCP is derived from the
characteristic of natural outdoor images that the intensity value of at least one color channel
within a local window is close to zero. Based on the DCP, the dehazing is accomplished
through four major steps: atmospheric light estimation, transmission map estimation,
transmission map refinement, and image reconstruction. This four-step dehazing process
makes it possible to provide a step-by-step approach to the complex solution of the ill-posed
inverse problem. This also enables us to shed light on the systematic contributions of recent
researches related to the DCP for each step of the dehazing process. Our detailed survey and
experimental analysis on DCP-based methods will help readers understand the effectiveness
of the individual step of the dehazing process and will facilitate development of advanced
dehazing algorithms.
Dark Channel Prior used by Kaiming for single image dehazing. His observation
revealed that, at least one colour channel of an rgb image has some pixels of lowest intensities,
which tends to zero. The dark channel suggests that at least one colour channel of an RGB
image have lowest intensities, which will almost tends to zero(When the pixels have lowest
intensities or tendency to zero, the colour diverges towards dark or black-That’s why he named
this phenomena as Dark Channel). So Kaiming He found this phenomena and used it for image
dehazing(To remove fog from natural outdoor image). By splitting the RGB image in Red
Green Blue channels and by selecting the minimum intensities pixels from all three channels
will result in some sort of dark image. Again dark channel can be refer to, selecting lowest
intensity pixels from three channels of a RGB image. The process of selecting the minimum
intense pixels from a RGB image can be refer to term prior, and we say it dark channel prior
DCP. For selecting the minimum pixels from an RGB colour channels a min{minimum
operator} is used.
ALGORITHM
MATLAB CODE:
fogged=imcomplement(fogged);
figure;
imshow(fogged);
figure,
imshow(defogged, []),title('Final Defogged Image');
defogged=imcomplement(defogged);
figure;
imshow(defogged, []),title('Final Defogged and enhanced Image');
if length(Airlight) == 1
Airlight = Airlight * ones(3, 1);
end
if length(C0) == 1
C0 = C0 * ones(3, 1);
end
if length(C1) == 1
C1 = C1 * ones(3, 1);
end
fogged = double(fogged);
% pixel-wise boundary
t_r = max((Airlight(1) - fogged(:, :, 1)) ./ (Airlight(1) - C0(1)), (fogged(:, :, 1)
- Airlight(1)) ./ (C1(1) - Airlight(1) ));
t_g = max((Airlight(2) - fogged(:, :, 2)) ./ (Airlight(2) - C0(2)), (fogged(:, :, 2) -
Airlight(2)) ./ (C1(2) - Airlight(2) ));
p2 = max((Airlight(3) - fogged(:, :, 3)) ./ (Airlight(3) - C0(3)), (fogged(:, :, 3) -
Airlight(3)) ./ (C1(3) - Airlight(3) ));
p2 = max(cat(3, t_r, t_g, p2), [], 3);
p2 = min(p2, 1);
% minimum filtering
se = strel('square', frame);
p1 = imclose(p2, se);
% normalizing filters
num_filters = length(d);
for k = 1 : num_filters
d{k} = d{k} / norm(d{k}(:));
end
Tf = fft2(bound_fogged);
DS = 0;
for k = 1 : num_filters
D{k} = psf2otf(d{k}, [nRows, nCols]);
DS = DS + abs(D{k}).^2;
end
DU = 0;
for k = 1 : num_filters
dt{k} = imfilter(bound_fogged, d{k}, 'circular');
u{k} = max(abs(dt{k}) - weight{k} / xponent / num_filters, 0) .* sign(dt{k});
DU = DU + fft2(imfilter(u{k}, flipud(fliplr(d{k})), 'circular'));
end
%%
function Weight = weight_function(fogged, D, val)
fogged = double(fogged) / 255;
d_r = imfilter(fogged(:, :, 1), D, 'circular');
d_g = imfilter(fogged(:, :, 2), D, 'circular');
d_b = imfilter(fogged(:, :, 3), D, 'circular');
Weight = exp(-(d_r.^2 + d_g.^2 + d_b.^2) / val / 2);
OUTPUT
INPUT IMAGE:
OUTPUT IMAGE: