-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathvisualization.py
More file actions
51 lines (42 loc) · 1.32 KB
/
Copy pathvisualization.py
File metadata and controls
51 lines (42 loc) · 1.32 KB
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
''' Code with utilities to visualize (e.g. point clouds)'''
import open3d as o3d
def show_point_cloud(coords):
"""
Shows point cloud in 3D
Parameters
----------
coords : Numpy array
3D coordinates of cloud points
"""
pcd = o3d.geometry.PointCloud()
pcd.points = o3d.utility.Vector3dVector(coords)
o3d.visualization.draw_geometries([pcd])
def progressbar(iteration, total, prefix='', suffix='', decimals=1, length=100, fill='#', print_end=''):
"""
Call in a loop to create terminal progress bar
Parameters
----------
iteration : int
Required. Current iteration
total : int
Required. Total iterations
prefix : string
Prefix string
suffix : string
Suffix string
decimals : int
Positive number of decimals in percent complete
length : int
Character length of bar
fill : string
Bar fill character
print_end : string
(e.g. "\r", "\r\n")
"""
percent = ("{0:." + str(decimals) + "f}").format(100 * (iteration / float(total)))
filled_length = int(length * iteration // total)
bar = fill * filled_length + '-' * (length - filled_length)
print(f'\r{prefix} |{bar}| {percent}% {suffix}', end=print_end)
# Print New Line on Complete
if iteration == total:
print()