One Logo Pool Ball
Vision · IOS API REFERENCE

ContoursObservation.Contour

struct · iOS 18.0+ · SDK 27.1

struct Contour

Members (14)

get · iOS 18.0+

childContours

TypeScript
get childContours(): Array<ContoursObservation_Contour>
Swift declaration
var childContours: [ContoursObservation.Contour] { get }

An array of contours that this contour encloses.

get · iOS 18.0+

pointCount

TypeScript
get pointCount(): number
Swift declaration
var pointCount: Int { get }

The contour’s number of points.

get · iOS 18.0+

aspectRatio

TypeScript
get aspectRatio(): number
Swift declaration
var aspectRatio: Float { get }

The aspect ratio of the contour. The aspect ratio is the original image’s width divided by its height.

get · iOS 26.0+

boundingBox

TypeScript
get boundingBox(): NormalizedRect
Swift declaration
var boundingBox: NormalizedRect { get }

The bounding box of the region.

get · iOS 18.0+

description

TypeScript
get description(): string
Swift declaration
var description: String { get }

A textual representation of this instance. Calling this property directly is discouraged. Instead, convert an instance of any type to a string by using the `String(describing:)` initializer. This initializer works with any type, and uses the custom `description` property for types that conform to `CustomStringConvertible`: struct Point: CustomStringConvertible { let x: Int, y: Int var description: String { return "(\(x), \(y))" } } let p = Point(x: 21, y: 30) let s = String(describing: p) print(s) // Prints "(21, 30)" The conversion of `p` to a string in the assignment to `s` uses the `Point` type's `description` property.

get · iOS 26.0+

boundingQuad

TypeScript
get boundingQuad(): RectangleObservation
Swift declaration
var boundingQuad: RectangleObservation { get }

The bounding quadrilateral of the region.

method · iOS 18.0+

calculateArea

TypeScript
calculateArea(useOrientedArea?: boolean): number
Swift declaration
func calculateArea(useOrientedArea: Bool = false) -> Double

Calculates the area enclosed by the contour. - Parameters: - useOrientedArea: Whether to calculate the signed area (positive for counterclockwise-oriented contours and negative for clockwise-oriented contours). If you specify false, the returned area is always positive. Attempting to calculate the area for a contour containing random points, or with self-crossing edges, produces undefined results.

method · iOS 18.0+

boundingCircle

TypeScript
boundingCircle(): NormalizedCircle
Swift declaration
func boundingCircle() -> NormalizedCircle

Creates a Circle that encloses the contour.

get · iOS 18.0+

normalizedPath

TypeScript
get normalizedPath(): _CoreGraphics_CGPath
Swift declaration
var normalizedPath: CGPath { get }

The contour object as a path in normalized coordinates.

get · iOS 18.0+

normalizedPoints

TypeScript
get normalizedPoints(): Array<SDKHandle>
Swift declaration
var normalizedPoints: [simd_float2] { get }

The contour’s array of points in normalized coordinates.

method · iOS 18.0+

calculatePerimeter

TypeScript
calculatePerimeter(): number
Swift declaration
func calculatePerimeter() -> Double

Calculate the perimeter of the contour.

method · iOS 18.0+

polygonApproximation

TypeScript
polygonApproximation(epsilon: number): ContoursObservation_Contour
Swift declaration
func polygonApproximation(epsilon: Float) throws -> ContoursObservation.Contour

Simplifies the contour to a polygon using a Ramer-Douglas-Peucker algorithm. - Parameters: - epsilon: This parameter defines the distance threshold the algorithm uses. It preserves points whose perpendicular distance to the line segment they are on is greater than epsilon, and removes all others. - Returns: A simplified polygon contour from the points of the original contour.

get · iOS 26.0+

points

TypeScript
get points(): Array<NormalizedPoint>
Swift declaration
var points: [NormalizedPoint] { get }

The points of the region as an array of `NormalizedPoint`.

get · iOS 18.0+

indexPath

TypeScript
get indexPath(): _Foundation_IndexPath
Swift declaration
var indexPath: IndexPath { get }

The contour object’s index path.

Skipped declarations

No declarations were skipped in this snapshot.

All Vision types →