-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsem3d_test_to_sem3D_labels.py
61 lines (51 loc) · 1.95 KB
/
sem3d_test_to_sem3D_labels.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
import numpy as np
import os
import scipy.misc
from tqdm import *
import json
#自己添加解决pyx
import pyximport
pyximport.install()
from pointcloud_tools.lib.python.PcTools import Semantic3D #修改
# load the configuration file and define variables
print("Loading configuration file")
import argparse
parser = argparse.ArgumentParser(description='Semantic3D')
parser.add_argument('--config', type=str, default="config.json", metavar='N',
help='config file')
args = parser.parse_args()
json_data=open(args.config).read()
config = json.loads(json_data)
input_dir = config["test_input_dir"]
voxel_size = config["voxel_size"]
output_dir = config["output_directory"]
filenames = [
"birdfountain_station1_xyz_intensity_rgb",
#"castleblatten_station1_intensity_rgb",
#"castleblatten_station5_xyz_intensity_rgb",
#"marketplacefeldkirch_station1_intensity_rgb",
#"marketplacefeldkirch_station4_intensity_rgb",
#"marketplacefeldkirch_station7_intensity_rgb",
#"sg27_station10_intensity_rgb",
#"sg27_station3_intensity_rgb",
#"sg27_station6_intensity_rgb",
#"sg27_station8_intensity_rgb",
#"sg28_station2_intensity_rgb",
#"sg28_station5_xyz_intensity_rgb",
#"stgallencathedral_station1_intensity_rgb",
#"stgallencathedral_station3_intensity_rgb",
#"stgallencathedral_station6_intensity_rgb"
# "New_Track_D_pts_xyzrgbi"
#"20180724ShenZhen02am-0012"
]
# create output directory
if not os.path.exists(output_dir):
os.makedirs(output_dir)
for filename in filenames:
print(filename)
semantizer = Semantic3D() #修改
semantizer.set_voxel_size(voxel_size)
mesh_filename = os.path.join(output_dir, filename+".ply")
sem3d_cloud_txt = os.path.join(input_dir,filename+".txt")
output_results = os.path.join(output_dir, filename+".txt")
semantizer.mesh_to_label_file_no_labels(mesh_filename,sem3d_cloud_txt,output_results)