Class

VNDetectRectanglesRequest

An image analysis request that finds projected rectangular regions in an image.

Declaration

class VNDetectRectanglesRequest : VNImageBasedRequest

Overview

A rectangle detection request locates regions of an image with rectangular shape, like credit cards, business cards, documents, and signs. The request returns its observations in the form of VNRectangleObservation objects, which contain normalized coordinates of bounding boxes containing the rectangle.

Use this type of request to find the bounding boxes of rectangles in an image. Vision returns observations for rectangles found in all orientations and sizes, along with a confidence level to indicate how likely it’s that the observation contains an actual rectangle.

To further configure or restrict the types of rectangles found, set properties on the request specifying a range of aspect ratios, sizes, and quadrature tolerance.

Topics

Configuring Rectangle Detection

var minimumAspectRatio: VNAspectRatio

A float specifying the minimum aspect ratio of the rectangle to detect, defined as the shorter dimension over the longer dimension.

var maximumAspectRatio: VNAspectRatio

A float specifying the maximum aspect ratio of the rectangle to detect, defined as the shorter dimension over the longer dimension.

var quadratureTolerance: VNDegrees

A float specifying the number of degrees a rectangle corner angle can deviate from 90°.

var minimumSize: Float

A float specifying the minimum size of the rectangle to be detected, as a proportion of the smallest dimension.

var minimumConfidence: VNConfidence

A value specifying the minimum acceptable confidence level.

var maximumObservations: Int

An integer specifying the maximum number of rectangles Vision returns.

typealias VNAspectRatio

A type alias for expressing rectangle aspect ratios in Vision.

typealias VNConfidence

A type alias for the confidence value of an observation.

typealias VNDegrees

A typealias for expressing tolerance angles in Vision.

Specifying a Revision

Relationships

Inherits From

Conforms To

See Also

Rectangle Detection

class VNRectangleObservation

Information about projected rectangular regions detected by an image analysis request.