1. 参考文献
2. 模型实现
% 论文: Naturalness Preserved Enhancement Algorithm for Non-Uniform Illumination Images
% 作者: Shuhang Wang, Hai-Miao Hu, Bo Li
% 链接:
% Author: HSW
% Date: 2018-04-29
%
clc;
close all;
clear;
img = imread('timg4.png');
[m, n, dims] = size(img);
downSample = 0; % 对图像进行降采样
scale = 0.5; % 降采样的比例
patchSize = 15; % 公式(12)
patchSizeQ = 3; % 公式(6)
neighborMode = 0; % = 0 表示采用四邻域, = 1 表示采用8邻域
isPostProcess = 1; % 是否进行中值滤波后处理
if dims == 3
if downSample == 1
m = uint8(m * scale);
n = uint8(n * scale);
img_in = imresize(img, [m, n]);
else
img_in = img;
end
figure;
imshow(img_in, []);
title('原图像');
% 初始估计亮度: 用亮通道进行初步估计
L_init = Illumination(img_in, 'max_c');
figure;
imshow(L_init, []);
title('L_{init}');
% 构造Bright-Pass Filter
L_r = filter_BPF(L_init, patchSize, patchSizeQ, neighborMode);
figure;
imshow(L_r, []);
title('L_{r}');
% 公式(13)
L_tmp = repmat(double(L_r), [1, 1, 3]);
R_c = double(img_in) ./ (L_tmp + (L_tmp == 0) .* 0.001);
% 公式(14)
epsilon = 1;
L_lg = log(double(L_r) + epsilon);
figure;
imshow(L_lg, []);
title('L_{lg}');
% 公式(17)
[cLv, mp] = weight_hist(L_lg, L_r);
% 公式(18) 和 (19)
[cfz, sz] = log_hist();
% 公式(22)
L_m = filter_BLT(L_r,