mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-13 03:14:00 +08:00
Lazy import for open3d in Blender DataParser (#3347)
lazy import for open3d in blender dataparser Co-authored-by: Ethan Weber <ethanjohnweber@meta.com>
This commit is contained in:
1 parent
9ffbc374f4
commit
ec10c49d51
1 file changed
+2
-1
@@ -22,7 +22,6 @@ from typing import Optional, Type
|
||||
|
||||
import imageio
|
||||
import numpy as np
|
||||
import open3d as o3d
|
||||
import torch
|
||||
|
||||
from nerfstudio.cameras.cameras import Cameras, CameraType
|
||||
@@ -116,6 +115,8 @@ class Blender(DataParser):
|
||||
return dataparser_outputs
|
||||
|
||||
def _load_3D_points(self, ply_file_path: Path):
|
||||
import open3d as o3d # Importing open3d is slow, so we only do it if we need it.
|
||||
|
||||
pcd = o3d.io.read_point_cloud(str(ply_file_path))
|
||||
|
||||
points3D = torch.from_numpy(np.asarray(pcd.points, dtype=np.float32) * self.config.scale_factor)
|
||||
|
||||
Reference in new issue
Block a user