-
Notifications
You must be signed in to change notification settings - Fork 58
/
EnhanceLine.m
85 lines (77 loc) · 2.58 KB
/
EnhanceLine.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
function line_enhanced = EnhanceLine(band)
%ENHANCELINE enhance NDBI to light urban/built-up areas and dark other
%bright surface, such as desert, rock. ref Guindon et. RSE 2004
% also can see the details at
% https://homepages.inf.ed.ac.uk/rbf/HIPR2/linedet.htm.
% band=data_toabt.BandGreen;
%
% band=ndbi;
%% line with a length of three pixels
% template1=[-1 1 0;
% -1 1 0;
% -1 1 0;];
% template2=[0 1 -1;
% 0 1 -1;
% 0 1 -1;];
% line_enhanced1 = imfilter(band,template1);
% line_enhanced2 = imfilter(band,template2);
% line_enhanced=max(line_enhanced1,line_enhanced2);
%
% template1=[-1 -1 -1;
% 1 1 1;
% 0 0 0;];
% template2=[0 0 0;
% 1 1 1;
% -1 -1 -1;];
% line_enhanced1 = imfilter(band,template1);
% line_enhanced2 = imfilter(band,template2);
% line_enhanced=max(line_enhanced1,line_enhanced);
% line_enhanced=max(line_enhanced2,line_enhanced);
%
% template1=[1 -1 -1;
% 0 1 -1;
% 0 0 1;];
% template2=[1 0 0;
% -1 1 0;
% -1 -1 1;];
% line_enhanced1 = imfilter(band,template1);
% line_enhanced2 = imfilter(band,template2);
% line_enhanced=max(line_enhanced1,line_enhanced);
% line_enhanced=max(line_enhanced2,line_enhanced);
%
% template1=[-1 -1 1;
% -1 1 0;
% 1 0 0;];
% template2=[0 0 1;
% 0 1 -1;
% 1 -1 -1;];
%
% line_enhanced1 = imfilter(band,template1);
% line_enhanced2 = imfilter(band,template2);
% line_enhanced=max(line_enhanced1,line_enhanced);
% line_enhanced=max(line_enhanced2,line_enhanced);
% line_enhanced = line_enhanced./3;
template=[-1 2 -1;
-1 2 -1;
-1 2 -1;];
template = template./6;
line_enhanced = imfilter(band,template);
template=[-1 -1 -1;
2 2 2;
-1 -1 -1;];
template = template./6;
line_enhanced_new = imfilter(band,template);
line_enhanced=max(line_enhanced_new,line_enhanced);
template =[2 -1 -1;
-1 2 -1;
-1 -1 2;];
template = template./6;
line_enhanced_new = imfilter(band,template);
line_enhanced=max(line_enhanced_new,line_enhanced);
template =[-1 -1 2;
-1 2 -1;
2 -1 -1;];
template = template./6;
line_enhanced_new = imfilter(band,template);
line_enhanced=max(line_enhanced_new,line_enhanced);
end