Contents

boundingBox(for:)

Calculates the bounding box around the characters in the range of a string.

Declaration

func boundingBox(for range: Range<String.Index>) -> RectangleObservation?

Parameters

  • range:

    The range of the characters in the text string to draw a bounding box around.

Return Value

The bounding box surrounding the characters recognized in the image.

Discussion

Bounding boxes aren’t always an exact fit around the characters. Use them to display in user interfaces to provide general guidance, but avoid using their contents for image processing.

The coordinates of the bounding box are normalized to the dimensions of the processed image, with the origin at the lower-left corner of the image.