Update app.py
Browse files
app.py
CHANGED
@@ -54,7 +54,19 @@ def create_point_cloud(inp):
|
|
54 |
|
55 |
pc = sampler.output_to_point_clouds(samples)[0] # Get the point cloud
|
56 |
|
57 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
fig = go.Figure(
|
59 |
data=[
|
60 |
go.Scatter3d(
|
@@ -64,8 +76,8 @@ def create_point_cloud(inp):
|
|
64 |
mode='markers',
|
65 |
marker=dict(
|
66 |
size=2,
|
67 |
-
color=
|
68 |
-
colorscale='Viridis', #
|
69 |
opacity=0.8
|
70 |
)
|
71 |
)
|
|
|
54 |
|
55 |
pc = sampler.output_to_point_clouds(samples)[0] # Get the point cloud
|
56 |
|
57 |
+
# Check if auxiliary channels (e.g., RGB) are available
|
58 |
+
if 'R' in pc.channels and 'G' in pc.channels and 'B' in pc.channels:
|
59 |
+
# Combine R, G, B channels into a single color value
|
60 |
+
colors = (
|
61 |
+
pc.channels['R'] / 255.0, # Normalize to [0, 1]
|
62 |
+
pc.channels['G'] / 255.0,
|
63 |
+
pc.channels['B'] / 255.0
|
64 |
+
)
|
65 |
+
else:
|
66 |
+
# Fall back to a single color if no RGB data is available
|
67 |
+
colors = 'blue' # Choose a default color
|
68 |
+
|
69 |
+
# Create a Plotly 3D scatter plot
|
70 |
fig = go.Figure(
|
71 |
data=[
|
72 |
go.Scatter3d(
|
|
|
76 |
mode='markers',
|
77 |
marker=dict(
|
78 |
size=2,
|
79 |
+
color=colors,
|
80 |
+
colorscale='Viridis' if isinstance(colors, tuple) else None, # Use Viridis if RGB
|
81 |
opacity=0.8
|
82 |
)
|
83 |
)
|