-
Notifications
You must be signed in to change notification settings - Fork 110
/
acv.m
executable file
·121 lines (103 loc) · 2.58 KB
/
acv.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
function DEM = acv(DEM)
%ACV Anisotropic coefficient of variation (ACV)
%
% Syntax
%
% C = acv(DEM)
%
% Description
%
% The anisotropic coefficient of variation describes the general
% geometry of the local land surface and can be used to distinguish
% elongated from oval landforms.
%
% Input
%
% DEM digital elevation model (GRIDobj)
%
% Output
%
% C Anisotropic coefficient of variation (ACV) (GRIDobj)
%
% Example
%
% DEM = GRIDobj('srtm_bigtujunga30m_utm11.tif');
% A = acv(DEM);
% imageschs(DEM,A)
%
% References
%
% Olaya, V. 2009: Basic land-surface parameters. In: Geomorphometry.
% Concepts, Software, Applications, Hengl, T. & Reuter, H. I. (Eds.),
% Elsevier, 33, 141-169.
%
% See also: CONV2, FILTER2, BWDIST
%
% Author: Wolfgang Schwanghart (w.schwanghart[at]geo.uni-potsdam.de)
% Date: 17. August, 2017
DEM.Z = acvfun(DEM.Z);
DEM.name = 'ACV';
%% %%%%%%%%%%%%%%%%%%%%%%%
% subfunction
function C = acvfun(dem)
siz = size(dem);
dem = padarray(dem,[2 2],nan);
inanpad = isnan(dem);
[~,L] = bwdist(~inanpad);
dem = dem(L);
k = [ 1 0 1 0 1; ...
0 0 0 0 0; ...
1 0 0 0 -1; ...
0 0 0 0 0; ...
-1 0 -1 0 -1];
dz_AVG = conv2(dem,k,'valid')/4;
F = { [ 0 0 0 0 0; ...
0 0 0 0 0; ...
1 0 0 0 -1; ...
0 0 0 0 0; ...
0 0 0 0 0];...
...
[ 1 0 0 0 0; ...
0 0 0 0 0; ...
0 0 0 0 0; ...
0 0 0 0 0; ...
0 0 0 0 -1];
...
[ 0 0 -1 0 0; ...
0 0 0 0 0; ...
0 0 0 0 0; ...
0 0 0 0 0; ...
0 0 -1 0 0];
...
[ 0 0 0 0 -1; ...
0 0 0 0 0; ...
0 0 0 0 0; ...
0 0 0 0 0; ...
1 0 0 0 0];...
};
ACV = zeros(siz);
for r = 1:4;
ACV = ACV + (conv2(dem,F{r},'valid') - dz_AVG).^2;
end
dem = dem(2:end-1,2:end-1);
F = { [ 0 0 0;...
1 0 -1;...
0 0 0];...
...
[ 1 0 0;...
0 0 0;...
0 0 -1];...
...
[ 0 1 0;...
0 0 0;...
0 -1 0];...
...
[ 0 0 1;...
0 0 0;...
-1 0 0];...
};
for r = 1:4;
ACV = ACV + (conv2(dem,F{r},'valid') - dz_AVG).^2;
end
dz_AVG = max(abs(dz_AVG),0.001);
C = log(1 + sqrt(ACV./8)./dz_AVG);