-
Notifications
You must be signed in to change notification settings - Fork 2
/
scale_interm.m
83 lines (53 loc) · 2.38 KB
/
scale_interm.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
68
69
70
71
72
73
74
75
76
77
78
79
80
% ========================================================================
% Fast Multi-Scale Structural Patch Decomposition for Multi-Exposure Image Fusion, TIP,2020
% algorithm Version 1.0
% Copyright(c) 2020, Hui Li, Kede Ma, Yongwei Yong and Lei Zhang
% All Rights Reserved.
% ----------------------------------------------------------------------
% Permission to use, copy, or modify this software and its documentation
% for educational and research purposes only and without fee is hereby
% granted, provided that this copyright notice and the original authors'
% names appear on all copies and supporting documentation. This program
% shall not be used, rewritten, or adapted as the basis of a commercial
% software or hardware product without first obtaining permission of the
% authors. The authors make no representations about the suitability of
% this software for any purpose. It is provided "as is" without express
% or implied warranty.
%----------------------------------------------------------------------
% Please refer to the following paper:
% H. Li et al., "Fast Multi-Scale Structural Patch Decomposition for Multi-Exposure Image Fusion, 2020" In press
% IEEE Transactions on Image Processing
% Please kindly report any suggestions or corrections to xiaohui102788@126.com
%----------------------------------------------------------------------
function [fI3, i_meant,aa,N1] = scale_interm(imgSeqColor,r)
[h,w,n]=size(imgSeqColor);
N = boxfilter(ones(h, w), r);
tem=ones(h, w);
tem(:,2:2:w)=0;
tem(2:2:h,:)=0;
N1= boxfilter(tem, r);
p=4;
[WD, Cmax,i_mean2]= weight_cal_detail(imgSeqColor,p,r);
WD=WD.*repmat(Cmax,[1 1 n]);
% WD= weight_cal_gray(imgSeqColor,[0 0 0 1 1 0 0]);
% WB= weight_cal_gray(imgSeqColor,[0 0 0 0 0 1 0]);
% WD=WB;
F_temp2_detail=zeros(h,w,n);
% F_temp2_base=zeros(h,w,n);
%% approximate aggregation through averaging(mean filter) the weight map
i_meant=zeros(ceil(h/2),ceil(w/2),2);
% tic
for i = 1:n
aa=i_mean2(:,:,i).*tem;
i_meant(:,:,i)=aa(1:2:h,1:2:w);
% i_meant2(:,:,i)=i_meant(:,:,i).*(1-edg(:,:,i));
% W_D1=boxfilter(aa.*WD(:,:,i), r)./ N;
% W_D2=boxfilter(tem.*WD(:,:,i), r)./ N;
W_D1=boxfilter(i_mean2(:,:,i).*WD(:,:,i), r)./ N;
W_D2=boxfilter(WD(:,:,i), r)./ N;
F_temp2_detail(:,:,i)=W_D2.*(imgSeqColor(:,:,i))-W_D1;
end
fI3=sum(F_temp2_detail,3);
% toc
%figure,imshow(mat2gray(fI3))
end