mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-15 20:33:59 +08:00
Add cropping options to data processing (#1236)
This commit is contained in:
1 parent
bd1060ee83
commit
5b50740f45
5 files changed
+159
-3
No files matched your search
@@ -32,6 +32,8 @@ def get_image_mask_tensor_from_path(filepath: Path, scale_factor: float = 1.0) -
|
||||
newsize = (int(width * scale_factor), int(height * scale_factor))
|
||||
pil_mask = pil_mask.resize(newsize, resample=Image.NEAREST)
|
||||
mask_tensor = torch.from_numpy(np.array(pil_mask)).unsqueeze(-1).bool()
|
||||
if len(mask_tensor.shape) != 3:
|
||||
raise ValueError("The mask image should have 1 channel")
|
||||
return mask_tensor
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user