-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfind_points.py
More file actions
43 lines (27 loc) · 877 Bytes
/
find_points.py
File metadata and controls
43 lines (27 loc) · 877 Bytes
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
#!/usr/bin/env python3
import numpy as np
import sys
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
color = np.load('bouncing_ball_13_frames_start_1_RGB.npy')
d13 = np.load('bouncing_ball_13_frames_start_1_YUV lle k=64 2d embedding.npy')
#d5 = np.load('bouncing_ball_5_frames_start_250_YUV lle k=64 2d embedding.npy')
new_points = []
rgb = []
for idx, p in enumerate(color):
t, x, y, r, g, b = p
if b > r + 10 and b > g + 10:
new_points.append(d13[idx])
rgb.append([r, g, b, 255])
if r > g + 10 and b > g + 10:
new_points.append(d13[idx])
rgb.append([r, g, b, 255])
embedding = np.matrix(new_points)
rgb = np.matrix(rgb)
rgb /= 255
x = embedding.T[np.array([0]), :]
y = embedding.T[np.array([1]), :]
fig = plt.figure()
ax = fig.add_subplot(111)
ax.scatter(x, y, c=rgb, marker='o')
plt.show()