Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
matmoimjs committed Sep 16, 2024
1 parent 6933e97 commit b1873f5
Show file tree
Hide file tree
Showing 19 changed files with 56,401 additions and 0 deletions.
623 changes: 623 additions & 0 deletions index.html

Large diffs are not rendered by default.

50 changes: 50 additions & 0 deletions npy2json.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import numpy as np
import json
import os
import matplotlib.pyplot as plt

prefix = 'data/'
dirs = ['0','1']

for d in dirs:
folder = prefix + d
datas = os.listdir(folder)
for data in datas:
subdir = os.path.join(folder,data)
files = os.listdir(subdir)
for file in files:
if '.npy' in file:
# print(file)
inname = os.path.join(subdir,file)
points = np.load(inname)
if 'cloud' in data:
# print('cropping')
points = points[np.linalg.norm(points,axis=1) < 50,:]
# plt.plot(points[:,0],points[:,1],'.')
# print(np.min(points,axis=0),np.max(points,axis=0))
# plt.show()
# print(pts.shape)
outname = os.path.join(subdir,file.replace('.npy','.json'))
if points.shape == 6:
print('RGB POINTCLOUD')
points_list = {"x": points[:,0].tolist(), "y": points[:,1].tolist(), "z": points[:,2].tolist(), "r": points[:,3].tolist(), "g": points[:,4].tolist(), "b": points[:,5].tolist()}
else:
points_list = {"x": points[:,0].tolist(), "y": points[:,1].tolist(), "z": points[:,2].tolist()}
points_json = json.dumps(points_list, indent=4)
with open(outname, 'w') as file:
file.write(points_json)

# Example array of points (replace this with your own data loading)
# path = 'data/1/pc/0.npy'
# points = np.load(path)
# # Convert the numpy array to a list of dictionaries
# points_list = {"x": points[:,0].tolist(), "y": points[:,1].tolist(), "z": points[:,2].tolist()}
#
#
# # Convert the list of dictionaries to JSON format
# points_json = json.dumps(points_list, indent=4)
#
# # Save or print the resulting JSON
#
# with open(path.replace('npy','json'), 'w') as file:
# file.write(points_json)
1 change: 1 addition & 0 deletions static/css/bulma-carousel.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions static/css/bulma-slider.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions static/css/bulma.css.map.txt

Large diffs are not rendered by default.

Loading

0 comments on commit b1873f5

Please sign in to comment.