Spaces:
Runtime error
Runtime error
jens
commited on
Commit
·
769894a
1
Parent(s):
7166941
plotly
Browse files
app.py
CHANGED
|
@@ -5,7 +5,7 @@ import cv2
|
|
| 5 |
from PIL import Image
|
| 6 |
import torch
|
| 7 |
from inference import SegmentPredictor
|
| 8 |
-
from utils import generate_PCL, PCL3
|
| 9 |
|
| 10 |
|
| 11 |
|
|
@@ -52,7 +52,7 @@ with block:
|
|
| 52 |
print("depth reconstruction")
|
| 53 |
image = inputs[raw_image]
|
| 54 |
# depth reconstruction
|
| 55 |
-
fig =
|
| 56 |
return {pcl_figure: fig}
|
| 57 |
|
| 58 |
depth_reconstruction_btn.click(on_depth_reconstruction_btn_click, components, [pcl_figure], queue=False)
|
|
|
|
| 5 |
from PIL import Image
|
| 6 |
import torch
|
| 7 |
from inference import SegmentPredictor
|
| 8 |
+
from utils import generate_PCL, PCL3, point_cloud
|
| 9 |
|
| 10 |
|
| 11 |
|
|
|
|
| 52 |
print("depth reconstruction")
|
| 53 |
image = inputs[raw_image]
|
| 54 |
# depth reconstruction
|
| 55 |
+
fig = point_cloud(image)
|
| 56 |
return {pcl_figure: fig}
|
| 57 |
|
| 58 |
depth_reconstruction_btn.click(on_depth_reconstruction_btn_click, components, [pcl_figure], queue=False)
|
utils.py
CHANGED
|
@@ -107,8 +107,10 @@ def point_cloud(rgb_image, depth_image):
|
|
| 107 |
data = {'x': points[:, 0], 'y': points[:, 1], 'z': points[:, 2],
|
| 108 |
'red': colors[:, 0], 'green': colors[:, 1], 'blue': colors[:, 2]}
|
| 109 |
df = pd.DataFrame(data)
|
|
|
|
|
|
|
| 110 |
# Step 6: Create a 3D scatter plot using Plotly Express
|
| 111 |
-
fig = px.scatter_3d(df, x='x', y='y', z='z', color='red',
|
| 112 |
|
| 113 |
return fig
|
| 114 |
|
|
|
|
| 107 |
data = {'x': points[:, 0], 'y': points[:, 1], 'z': points[:, 2],
|
| 108 |
'red': colors[:, 0], 'green': colors[:, 1], 'blue': colors[:, 2]}
|
| 109 |
df = pd.DataFrame(data)
|
| 110 |
+
size = np.zeros(len(df))
|
| 111 |
+
size[:] = 0.01
|
| 112 |
# Step 6: Create a 3D scatter plot using Plotly Express
|
| 113 |
+
fig = px.scatter_3d(df, x='x', y='y', z='z', color='red', size=size)
|
| 114 |
|
| 115 |
return fig
|
| 116 |
|