计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
geometry【效率与协作】Use GradSLAM's tensor geometry utilities for camera projection, homogeneous coordinates, pixel grids, rigid transforms, quaternions, SE(3) exponential maps, and point or normal frame changes.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this skill when a GradSLAM operation needs camera-coordinate projection, depth unprojection, intrinsics handling, pixel-grid conversion, rigid-body transforms, quaternion rotation, or Lie-group SE(3) updates. The functions are PyTorch tensor operations: preserve the input dtype/device and keep tensors in the expected trailing-dimension layout.
Read the focused contracts in api-reference.md before selecting a function. Use workflows.md for projection/unprojection and transform pipelines, and troubleshooting.md when a shape, frame, dtype, or gradient check fails.
gradslam.geometry exports the projective functions from projutils:
homogenize_pointsunhomogenize_pointsproject_pointsunproject_pointsinverse_intrinsicsThe package root also re-exports these projective names. Do not assume that
other geometry helpers are attributes of gradslam.geometry; import them from
their implementation modules explicitly:
from gradslam.geometry import project_points, unproject_points
from gradslam.geometry.geometryutils import (
cam2pixel,
compose_transforms_3d,
create_meshgrid,
relative_transformation,
transform_normals,
transform_pointcloud,
transform_pts_3d,
)
from gradslam.geometry.se3utils import se3_exp, so3_exp
se3_exp is specifically a direct se3utils import. The same is true of
so3_hat, se3_hat, and so3_exp. geometryutils also contains a second
implementation of homogeneous conversion plus transform and pixel-grid
helpers; importing from that module is intentional when using those helpers,
not an alternate package-level export.
t_ab in
transform_pts_3d(pts_b, t_ab) maps coordinates expressed in frame b to
frame a. Matrix composition compose_transforms_3d(t1, t2) computes
t1 @ t2, so t2 is applied first.unproject_points takes
an inverse 3x3 matrix and a depth tensor with shape exactly equal to the
pixel tensor without its last coordinate. inverse_intrinsics is a fast
pinhole inverse for the supported 3x3/4x4 layout, not a general matrix
inverse.eps are left unscaled by unhomogenize_points; projected depth exactly
equal to zero is divided by one. These guards avoid infinities but do not
provide a physically meaningful point at infinity..numpy(), .item() in the computational path,
or in-place edits to leaf tensors requiring gradients.inverse_transfom_3d assumes an orthogonal rotation. Use
relative_transformation(..., orthogonal_rotations=False) when the input
may be a general invertible homogeneous matrix.quaternion_to_rotation_matrix expects
(x, y, z, w) and flattens leading batch dimensions beyond one batch axis;
normalize_pixel_coords currently applies the first image-size factor to
both coordinates. See the API and troubleshooting references rather than
silently correcting these behaviors in a caller.projutils
functions for public camera code; use the geometryutils versions only when
a transform helper in that module is also required.project_points with a 4x4 projection
matrix; it accepts (..., 3) or (..., 4) points.unproject_points with a 3x3
inverse intrinsics matrix and matching depth shape.inverse_intrinsics for the library's pinhole K
layout, including the 4x4 form used by RGB-D structures.transform_pts_3d or
transform_pointcloud; rotate normals without translation using
transform_normals.relative_transformation for batched or general
invertible poses; use relative_transform_3d for matching rigid tensors.se3_exp on a six-vector ordered as
(translation, rotation); it returns a 4x4 transform.The bundled CPU smoke check is
scripts/geometry_smoke.py. It uses only deterministic in-memory tensors and
has no network, display, dataset, or GPU path.