1. 参考文献
2. 暗通道模型
2.1 暗通道模型Demo
clc
close all;
clear all;
addpath(fullfile('Images\'));
imageName = 'sweden.jpg';
patch_size = 3;
[I I_out J T_est T A] = removeHaze( imageName, patch_size );
figure;
imshow(I);
figure;
imshow(J);
figure;
imshow(T_est);
figure;
imshow(I_out);
imageName = 'plane.jpg';
[I I_out J T_est T A] = removeHaze( imageName, patch_size );
figure;
imshow(I);
figure;
imshow(J);
figure;
imshow(T_est);
figure;
imshow(I_out);
2.2 暗通道模型实现
function T_colored = colorTransmission( T )
%COLORTRANSMISSION Summary of this function goes here
% Detailed explanation goes here
t = size(T);
T_colored = zeros(t(1), t(2), 3);
maxT = max(max(max(T)));
minT = min(min(min(T)));
avg = (maxT + minT)/2;
T_colored(:,:,1) = T > ( maxT - avg/2 );
T_colored(:,:,2) = ((minT+avg/2) < T) .* (T < (maxT-avg/2));
T_colored(:,:,3) = T < minT+avg/2;
end
function A = estimateA( I, J, numPixels )
%ESTIMATEA Summary of this function goes here
% Detailed explanation goes here
% Make a list of the brightest pixels
brightestJ = zeros(numPixels,3);
[x_dim y_dim] = size(J);
for i = 1:x_dim
for j = 1:y_dim
[minElement, index] = min(brightestJ(:,3));
if J(i,j) > minElement
brightestJ(index,:) = [i j J(i,j)];
end
end
end
% Find the highest intensity pixel from the original Image using the
% list calculated above
highes