Spaces:
Paused
Paused
Abdulrahman1989
commited on
Commit
·
2eeb736
1
Parent(s):
5baf998
Fix the code and convert the image to NumPy
Browse files- Image3DProcessor.py +5 -2
Image3DProcessor.py
CHANGED
@@ -61,7 +61,10 @@ class Image3DProcessor:
|
|
61 |
|
62 |
@torch.no_grad()
|
63 |
def reconstruct_and_export(self, image):
|
64 |
-
|
|
|
|
|
|
|
65 |
image_tensor = to_tensor(image).to(self.device)
|
66 |
view_to_world_source, rot_transform_quats = get_source_camera_v2w_rmo_and_quats()
|
67 |
view_to_world_source = view_to_world_source.to(self.device)
|
@@ -98,4 +101,4 @@ class Image3DProcessor:
|
|
98 |
rendered_image = t_to_512(rendered_image)
|
99 |
loop_renders.append(torch.clamp(rendered_image * 255, 0.0, 255.0).detach().permute(1, 2, 0).cpu().numpy().astype(np.uint8))
|
100 |
|
101 |
-
return mesh_path, video_path
|
|
|
61 |
|
62 |
@torch.no_grad()
|
63 |
def reconstruct_and_export(self, image):
|
64 |
+
# Convert PIL Image to NumPy array if needed
|
65 |
+
if isinstance(image, Image.Image):
|
66 |
+
image = np.array(image)
|
67 |
+
|
68 |
image_tensor = to_tensor(image).to(self.device)
|
69 |
view_to_world_source, rot_transform_quats = get_source_camera_v2w_rmo_and_quats()
|
70 |
view_to_world_source = view_to_world_source.to(self.device)
|
|
|
101 |
rendered_image = t_to_512(rendered_image)
|
102 |
loop_renders.append(torch.clamp(rendered_image * 255, 0.0, 255.0).detach().permute(1, 2, 0).cpu().numpy().astype(np.uint8))
|
103 |
|
104 |
+
return mesh_path, video_path
|