|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
import os
|
|
|
|
|
import pickle
|
|
|
|
|
|
|
|
|
|
import mcubes
|
|
|
|
|
import numpy as np
|
|
|
|
@ -124,8 +125,9 @@ ray_d_norm = torch.norm(ray_d)
|
|
|
|
|
ray_d = ray_d / ray_d_norm
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
N = 100
|
|
|
|
|
t = np.linspace(-1, 1, N + 1)
|
|
|
|
|
N = 256
|
|
|
|
|
t = np.linspace(-2, 2, N + 1)
|
|
|
|
|
# A cube of size 2x2x2 is necessary to contain a sphere of radius 1.0
|
|
|
|
|
|
|
|
|
|
query_pts = np.stack(np.meshgrid(t, t, t), -1).astype(np.float32)
|
|
|
|
|
# print(query_pts.shape)
|
|
|
|
@ -167,6 +169,10 @@ fg_sigma = np.array(fg_raw_voxel)
|
|
|
|
|
# bg_sigma = np.array(bg_raw_voxel)
|
|
|
|
|
threshold = 0.5
|
|
|
|
|
|
|
|
|
|
# save the raw_voxel in pickle format
|
|
|
|
|
fd = open("raw_voxel_256.pkl", "wb")
|
|
|
|
|
pickel.dump(fg_sigma, fd)
|
|
|
|
|
fd.close()
|
|
|
|
|
|
|
|
|
|
# vertices, triangles = mcubes.marching_cubes(sigma, threshold)
|
|
|
|
|
# mesh = trimesh.Trimesh(vertices / N - .5, triangles)
|
|
|
|
|