-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot_detection_points.py
56 lines (43 loc) · 1.53 KB
/
plot_detection_points.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
import json
import matplotlib.pyplot as plt
import os
os.makedirs('out', exist_ok=True)
os.makedirs('img', exist_ok=True)
with open('out/detection_points.json', 'r') as json_file:
detection_points_data = json.load(json_file)
data = detection_points_data['data']
detection_point_coords = []
for idx, info in data.items():
detection_point_coords.extend(info['detection_points'])
detection_point_x_coords_2d = []
detection_point_y_coords_2d = []
detection_point_z_coords_2d = []
for dpc in detection_point_coords:
detection_point_x_coords_2d.append(dpc[0])
detection_point_y_coords_2d.append(dpc[1])
detection_point_z_coords_2d.append(dpc[2])
# print(min(detection_point_z_coords_2d),max(detection_point_z_coords_2d))
plt.scatter(detection_point_x_coords_2d, detection_point_y_coords_2d)
plt.title('Detection points of particles')
plt.xlabel('X (m)')
plt.ylabel('Y (m)')
plt.savefig('img/2d_plot_detection_points.png')
# plt.show()
# Z vs y
plt.figure()
plt.scatter(detection_point_z_coords_2d, detection_point_y_coords_2d)
plt.title('Detection points of particles: Z vs y')
plt.xlabel('Z (m)')
plt.ylabel('Y (m)')
plt.savefig('img/2d_plot_detection_points_z_vs_y.png')
# plt.show()
fig = plt.figure()
ax = fig.add_subplot(projection='3d')
ax.scatter(detection_point_x_coords_2d, detection_point_y_coords_2d, detection_point_z_coords_2d)
plt.title('Detection points of particles')
ax.set_xlabel('X (m)')
ax.set_ylabel('Y (m)')
ax.set_zlabel('Z (m)')
# ax.set_zlim(-300, 300)
plt.savefig('img/3d_plot_detection_points.png')
# plt.show()