-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildings_extraction.py
73 lines (68 loc) · 2.06 KB
/
buildings_extraction.py
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
# This file is meant to extract point clouds classified as Buildings (laz/las)
# expected export format: laz/las file
# Version 1.0.0:
# changes : initial script
# Author: Walid Ghariani
import sys
import pdal
import json
def buildings_extraction(infile, filtertype, extract_Buildings):
''' Point clouds proccessing pipeline to create a segmented
Args:
infile (str): input laz/las file
segmented_pts (str): output laz/las file of Segmenetation using Approximate Coplanar Filter
extract_Buildings (str): output las/las file of extracted buildings
'''
pipe_Build =\
{
"pipeline":[
"./output_lidar/"+infile,
{
"type":"filters.elm",
"threshold":2.0
},
{
"type":"filters.outlier",
"method":"statistical",
"mean_k":8,
"multiplier":2
},
{
"type":"filters."+filtertype
},
{
"type":"filters.hag"
},
{
"type":"filters.range",
"limits":"Classification[1:1]"
},
{
"type":"filters.approximatecoplanar",
"knn":64,
"thresh1":25,
"thresh2":6
},
{
"type":"filters.range",
"limits":"Coplanar[1:1]"
},
{
"filename":"./output_lidar/"+extract_Buildings,
"extra_dims":"all"
}
]
}
# Buildings extraction
print("-----> Extracting Buildings point clouds: In progress")
pipelineBuildings = pdal.Pipeline(json.dumps(pipe_Build))
pipelineBuildings.validate()
pipelineBuildings.execute()
print("-----> Extracting Buildings point clouds: Done")
def main() :
infile = sys.argv[1]
filtertype = sys.argv[2]
extract_Buildings = sys.argv[3]
buildings_extraction(infile,filtertype, extract_Buildings)
if __name__ == "__main__":
main()