mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-02 13:59:10 +08:00
camtoworld is already a tensor in sdfstudio_data (#2777)
camtoworld is already a tensor
This commit is contained in:
1 parent
05d305467f
commit
a6a3dedc0e
1 file changed
+3
-2
@@ -21,6 +21,7 @@ from typing import Dict
|
|||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import torch
|
import torch
|
||||||
|
from torch import Tensor
|
||||||
|
|
||||||
from nerfstudio.data.dataparsers.base_dataparser import DataparserOutputs
|
from nerfstudio.data.dataparsers.base_dataparser import DataparserOutputs
|
||||||
from nerfstudio.data.datasets.base_dataset import InputDataset
|
from nerfstudio.data.datasets.base_dataset import InputDataset
|
||||||
@@ -64,7 +65,7 @@ class SDFDataset(InputDataset):
|
|||||||
|
|
||||||
return metadata
|
return metadata
|
||||||
|
|
||||||
def get_depths_and_normals(self, depth_filepath: Path, normal_filename: Path, camtoworld: np.ndarray):
|
def get_depths_and_normals(self, depth_filepath: Path, normal_filename: Path, camtoworld: Tensor):
|
||||||
"""function to process additional depths and normal information
|
"""function to process additional depths and normal information
|
||||||
Args:
|
Args:
|
||||||
depth_filepath: path to depth file
|
depth_filepath: path to depth file
|
||||||
@@ -83,7 +84,7 @@ class SDFDataset(InputDataset):
|
|||||||
normal = normal * 2.0 - 1.0 # omnidata output is normalized so we convert it back to normal here
|
normal = normal * 2.0 - 1.0 # omnidata output is normalized so we convert it back to normal here
|
||||||
normal = torch.from_numpy(normal).float()
|
normal = torch.from_numpy(normal).float()
|
||||||
|
|
||||||
rot = torch.from_numpy(camtoworld[:3, :3])
|
rot = camtoworld[:3, :3]
|
||||||
|
|
||||||
normal_map = normal.reshape(3, -1)
|
normal_map = normal.reshape(3, -1)
|
||||||
normal_map = torch.nn.functional.normalize(normal_map, p=2, dim=0)
|
normal_map = torch.nn.functional.normalize(normal_map, p=2, dim=0)
|
||||||
|
|||||||
Reference in new issue
Block a user