图像除雾序列——暗通道模型

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
  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值