-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLPfilterPlusDec.m
47 lines (40 loc) · 1.7 KB
/
LPfilterPlusDec.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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Description:
% LPfilterPlusDec filters and decimates the image I_PAN using a Starck and Murtagh (S&M) filter.
%
% Interface:
% I_PAN_LR = LPfilterPlusDec(I_PAN,ratio)
%
% Inputs:
% I_PAN: Image to be filtered and decimated;
% ratio: Scale ratio between MS and PAN. Pre-condition: Resize factors power of 2.
%
% Outputs:
% I_PAN_LR: Filtered and decimated image.
%
% References:
% [Starck07] J.-L. Starck, J. Fadili, and F. Murtagh, “The undecimated wavelet decomposition and its reconstruction,? IEEE Transactions on Image
% Processing, vol. 16, no. 2, pp. 297?309, February 2007.
% [Vivone14] G. Vivone, L. Alparone, J. Chanussot, M. Dalla Mura, A. Garzelli, G. Licciardi, R. Restaino, and L. Wald, “A Critical Comparison Among Pansharpening Algorithms?,
% IEEE Transaction on Geoscience and Remote Sensing, 2014. (Accepted)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function I_PAN_LR = LPfilterPlusDec(I_PAN,ratio)
h=[1 4 6 4 1 ]/16;
g=[0 0 1 0 0 ]-h;
htilde=[ 1 4 6 4 1]/16;
gtilde=[ 0 0 1 0 0 ]+htilde;
h=sqrt(2)*h;
g=sqrt(2)*g;
htilde=sqrt(2)*htilde;
gtilde=sqrt(2)*gtilde;
WF={h,g,htilde,gtilde};
Levels = ceil(log2(ratio));
%if verLessThan('matlab','8.4')
WT = ndwt2_working(I_PAN,Levels,WF);
% else
% WT = swt2(I_PAN, Levels, h,g);
% end
for ii = 2 : numel(WT.dec), WT.dec{ii} = zeros(size(WT.dec{ii})); end
I_PAN_LR = indwt2_working(WT,'c');
I_PAN_LR = imresize(I_PAN_LR,1/ratio,'nearest');
end