> ## Documentation Index
> Fetch the complete documentation index at: https://legacy-docs.chunkr.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Bounding box

The bounding box is a rectangle that bounds an item on the document. It is used for both segments and ocr results.

## Bounding Box Model

The `BoundingBox` model represents the bounding box and can be used to for highlights and annotations, as well as for VLM input as images.

```typescript theme={null}
interface BoundingBox {
  left: number;
  top: number;
  width: number;
  height: number;
}
```

## Relative bounding box for OCR results

The bounding boxes for the OCR results are relative to the segment, so you might need to convert them to the document coordinate system before using them.

```typescript theme={null}
function convertToDocumentCoordinates(
  bbox: BoundingBox,
  segment: Segment
): BoundingBox {
  return {
    left: bbox.left + segment.bbox.left,
    top: bbox.top + segment.bbox.top,
    width: bbox.width,
    height: bbox.height,
  };
}
```

Click [here](/ocr) to learn more about the OCR results.
