Skip to content

Instantly share code, notes, and snippets.

@ventusff
Created December 31, 2021 07:31
Show Gist options
  • Save ventusff/043e09ad60320f42c80d96f350437469 to your computer and use it in GitHub Desktop.
Save ventusff/043e09ad60320f42c80d96f350437469 to your computer and use it in GitHub Desktop.
if __name__ == "__main__":
from scipy.spatial.transform import Rotation as R
from scipy.interpolate import interp1d
# test = 'easy'
test = 'hard'
_intr3x3 = torch.tensor([[500,0,1000],[0,500,500],[0,0,1]])
cam_intrinsic = torch.eye(4, dtype=torch.double)
cam_intrinsic[:3, :3] = _intr3x3
if test == 'easy':
world_dimension = 3
trans_knots = np.random.uniform(-100, 100, size=(3,world_dimension))
interp = interp1d([0,10,20], trans_knots, axis=0)
rots = np.tile(np.eye(3), [20,1,1])
trans = np.zeros([20,3])
trans[:, :world_dimension] = interp(np.arange(20))
elif test == 'hard':
rots = R.random(20).as_matrix()
trans = np.random.uniform(-100, 100, size=(20,3))
c2ws = np.tile(np.eye(4), [20,1,1])
c2ws[:, :3, :3] = rots
c2ws[:, :3, 3] = trans
octforest = OctForest(tree_size=64, near=0.1, far=100, intrinsic=cam_intrinsic, c2ws=c2ws)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment