Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

docs(geometry): add inline note on bbox_generator3d size defect (#4018) (#4586)

Divyansh Sahariya3f748920ec90
diff --git a/kornia/geometry/bbox.py b/kornia/geometry/bbox.py
index 44d1f2a16..3bea8752a 100644
--- a/kornia/geometry/bbox.py
+++ b/kornia/geometry/bbox.py
@@ -655,6 +655,7 @@ def bbox_generator3d(
bbox[:, :, 0] += x_start.view(-1, 1)
bbox[:, :, 1] += y_start.view(-1, 1)
bbox[:, :, 2] += z_start.view(-1, 1)
+ # Extent is start + size, not start + size - 1: see the warning in this function's docstring (#4018).
bbox[:, 1, 0] += width.view(-1)
bbox[:, 2, 0] += width.view(-1)
bbox[:, 2, 1] += height.view(-1)
@@ -662,6 +663,7 @@ def bbox_generator3d(
# back
bbox_back = bbox.clone()
+ # Extent is start + size, not start + size - 1: see the warning in this function's docstring (#4018).
bbox_back[:, :, -1] += depth.view(-1, 1).expand(-1, 4)
bbox = torch.cat([bbox, bbox_back], dim=1)