-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDemo.m
67 lines (56 loc) · 1.32 KB
/
Demo.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
clc;
clear all;
close all;
f1=imread("c08_1.bmp");
f2=imread("c08_2.bmp");
f1=im2double(f1);
f2=im2double(f2);
if size(f1,3)>1
f1=rgb2gray(f1);
end
if size(f2,3)>1
f2=rgb2gray(f2);
end
%figure,imshow(f1); figure,imshow(f2);
D=cell2mat(struct2cell(load('Dzq.mat')));
%%
lambda = 1;
npad = 10;
[lowpass1, high1] = lowpass(f1, lambda, npad);
[lowpass2, high2] = lowpass(f2, lambda, npad);
%% lowpass fusion
% Smoothing
GA = im2double(lowpass1);
GB = im2double(lowpass2);
%figure,imshow(GA);figure,imshow(GB);
r = 3;
h = [1 -1];
[hei, wid] = size(GA);
N = boxfilter(ones(hei, wid), r);
Ga= RollingGuidanceFilter(GA,3,0.05,7);
Gb= RollingGuidanceFilter(GB,3,0.05,7);
%%
MA = abs(conv2(Ga,h,'same')) + ...
abs(conv2(Ga,h','same'));
MB = abs(conv2(Gb,h,'same')) + ...
abs(conv2(Gb,h','same'));
%figure,imshow(MA);figure,imshow(MB);
d = MA - MB;
%figure,imshow(d);
IA = boxfilter(d,r) ./ N>0;
IB=1-IA;
%%
for t = 1:6
IA = double(IA > 0.5);
IA = RF(IA, 15 , 0.3, 1, GA);
end
IB=1-IA;
%%
fused_low=im2double(lowpass1).*IA+IB.*im2double(lowpass2);
%figure,imshow(fused_low);
%% highpass fusion
overlap=7;
epsilon=0.01;
fused_high=sparse_fusion(high1,high2,D,overlap,epsilon);
F=fused_high+fused_low;
figure,imshow(F);