-
Notifications
You must be signed in to change notification settings - Fork 15
/
detail_enhancement.m
52 lines (39 loc) · 1.22 KB
/
detail_enhancement.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
clear; close all;
addpath('./funs')
%% images
Img = imread('./imgs/detail_enhancement/tree.png');
%% parameters (SP-2 mode)
smallNum = 1e-3; % try 1e-4 for different smoothing results
thr = 1; % this value should be larger than the maximum intensity value
lambda = 20;
rData = 1;
rSmooth = 1;
aData = smallNum;
aSmooth = smallNum;
bData = thr;
bSmooth = thr;
alpha = 0.2;
stride = 1;
iterNum = 1;
%% smooth
Out_SP = generalized_smooth(Img, Img, lambda, rData, rSmooth, aData, bData, aSmooth, bSmooth, alpha, stride, iterNum);
%% parameters (EP-1 mode/WLS filter)
lambda = 1;
rData = 0;
% the rest remain the same
%% smooth
Out_EP = generalized_smooth(Img, Img, lambda, rData, rSmooth, aData, bData, aSmooth, bSmooth, alpha, stride, iterNum);
%% parameters (EP-1 mode/WLS filter, another way to achieve WLS smoothing)
% lambda = 1;
% rData = 0;
% aSmooth = thr;
% alpha = 1.2;
% % the rest remain the same
%
% %% smooth
% Out_EP = generalized_smooth(Img, Img, lambda, rData, rSmooth, aData, bData, aSmooth, bSmooth, alpha, stride, iterNum);
%% show and compare the results
Img = double(Img);
figure; imshow(uint8(Img))
figure; imshow(uint8([Out_SP, Out_EP]))
figure; imshow(uint8([Img + 5 * (Img - Out_SP), Img + 5 * (Img - Out_EP)]))