An AMR may need to know where a pallet appears in its camera image before it can slow down or inspect the scene more closely. A bounding box provides that approximate location with only four numbers.
1. What is a Bounding Box?
A 2D bounding box is the smallest—or simply a chosen—rectangle used to describe where an object appears in an image. Most detectors return axis-aligned boxes, whose sides remain parallel to the image edges.
The same rectangle is commonly written in three formats:
| Format | Four values | Meaning |
|---|---|---|
XYXY | Top-left and bottom-right corners | |
XYWH | Top-left corner, width, and height | |
CXCYWH | Centre, width, and height |
and locate the top-left corner, and locate the opposite corner, and locate the centre, and and are the width and height. Always state the format: the tuple [100, 80, 40, 30] describes different rectangles under XYXY and CXCYWH.
1.1 What a Box Preserves—and What It Loses
A box is compact. It can crop an image, associate a category with a region, or tell another model where to inspect. But every pixel inside the rectangle is not necessarily part of the object. Background appears around angled or irregular shapes, and overlapping boxes do not prove that objects touch in 3D.
| Representation | Best used for |
|---|---|
| Bounding box | Approximate location and extent |
| Binary mask | Exact selected pixels |
| Keypoint | One meaningful image position |
| 6D pose | Object position and orientation in 3D |
For an industrial arm, a box can nominate a component but rarely defines a safe grasp. Segmentation, depth, calibration, and collision checks must add the missing geometry.
1.2 Comparing Two Boxes
Detectors are often evaluated with intersection over union:
and are two box regions, is their overlapping area, and is the total area covered by either box. An IoU of 1 means identical boxes; 0 means no overlap. IoU measures image overlap, not category correctness or grasp accuracy.
2. Bounding Boxes in Telekinesis
Telekinesis uses datatypes.Box2D for one axis-aligned box. Its native format is [cx, cy, width, height], or CXCYWH.
from telekinesis import datatypes
box = datatypes.Box2D([320, 240, 180, 120])
print(box.center) # [320, 240]
print(box.dimensions) # [180, 120]
print(box.area) # 21600
When another system uses corner coordinates, construct or export the box explicitly with from_xyxy(), from_xywh(), as_xyxy(), or as_xywh(). Explicit conversion prevents one of the most common detection-integration errors.