feat: add manual ground-plane overlay to visualize_extrinsics.py
This commit is contained in:
@@ -457,6 +457,23 @@ def run_diagnostics(poses: Dict[str, np.ndarray], convention: str):
|
||||
is_flag=True,
|
||||
help="Run numerical diagnostics on the poses.",
|
||||
)
|
||||
@click.option(
|
||||
"--show-ground/--no-show-ground",
|
||||
default=True,
|
||||
help="Show a ground plane at Y=ground-y.",
|
||||
)
|
||||
@click.option(
|
||||
"--ground-y",
|
||||
type=float,
|
||||
default=0.0,
|
||||
help="Y height of the ground plane.",
|
||||
)
|
||||
@click.option(
|
||||
"--ground-size",
|
||||
type=float,
|
||||
default=8.0,
|
||||
help="Size of the ground plane (side length in meters).",
|
||||
)
|
||||
def main(
|
||||
input: str,
|
||||
output: Optional[str],
|
||||
@@ -471,6 +488,9 @@ def main(
|
||||
resolution: str,
|
||||
eye: str,
|
||||
diagnose: bool,
|
||||
show_ground: bool,
|
||||
ground_y: float,
|
||||
ground_size: float,
|
||||
):
|
||||
"""Visualize camera extrinsics from JSON using Plotly."""
|
||||
try:
|
||||
@@ -526,6 +546,26 @@ def main(
|
||||
intrinsics=cam_intrinsics,
|
||||
)
|
||||
|
||||
if show_ground:
|
||||
half_size = ground_size / 2.0
|
||||
x_grid = np.linspace(-half_size, half_size, 2)
|
||||
z_grid = np.linspace(-half_size, half_size, 2)
|
||||
x_mesh, z_mesh = np.meshgrid(x_grid, z_grid)
|
||||
y_mesh = np.full_like(x_mesh, ground_y)
|
||||
|
||||
fig.add_trace(
|
||||
go.Surface(
|
||||
x=x_mesh,
|
||||
y=y_mesh,
|
||||
z=z_mesh,
|
||||
showscale=False,
|
||||
opacity=0.15,
|
||||
colorscale=[[0, "gray"], [1, "gray"]],
|
||||
name="Ground Plane",
|
||||
hoverinfo="skip",
|
||||
)
|
||||
)
|
||||
|
||||
# Configure layout
|
||||
scene_dict: Dict[str, Any] = dict(
|
||||
xaxis_title="X (m)",
|
||||
|
||||
Reference in New Issue
Block a user