childContours
TypeScriptget childContours(): Array<ContoursObservation_Contour>Swift declarationvar childContours: [ContoursObservation.Contour] { get }An array of contours that this contour encloses.
struct · iOS 18.0+ · SDK 27.1
struct Contourget childContours(): Array<ContoursObservation_Contour>Swift declarationvar childContours: [ContoursObservation.Contour] { get }An array of contours that this contour encloses.
get pointCount(): numberSwift declarationvar pointCount: Int { get }The contour’s number of points.
get aspectRatio(): numberSwift declarationvar aspectRatio: Float { get }The aspect ratio of the contour. The aspect ratio is the original image’s width divided by its height.
get boundingBox(): NormalizedRectSwift declarationvar boundingBox: NormalizedRect { get }The bounding box of the region.
get description(): stringSwift declarationvar 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 boundingQuad(): RectangleObservationSwift declarationvar boundingQuad: RectangleObservation { get }The bounding quadrilateral of the region.
calculateArea(useOrientedArea?: boolean): numberSwift declarationfunc calculateArea(useOrientedArea: Bool = false) -> DoubleCalculates 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.
boundingCircle(): NormalizedCircleSwift declarationfunc boundingCircle() -> NormalizedCircleCreates a Circle that encloses the contour.
get normalizedPath(): _CoreGraphics_CGPathSwift declarationvar normalizedPath: CGPath { get }The contour object as a path in normalized coordinates.
get normalizedPoints(): Array<SDKHandle>Swift declarationvar normalizedPoints: [simd_float2] { get }The contour’s array of points in normalized coordinates.
calculatePerimeter(): numberSwift declarationfunc calculatePerimeter() -> DoubleCalculate the perimeter of the contour.
polygonApproximation(epsilon: number): ContoursObservation_ContourSwift declarationfunc polygonApproximation(epsilon: Float) throws -> ContoursObservation.ContourSimplifies 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 points(): Array<NormalizedPoint>Swift declarationvar points: [NormalizedPoint] { get }The points of the region as an array of `NormalizedPoint`.
get indexPath(): _Foundation_IndexPathSwift declarationvar indexPath: IndexPath { get }The contour object’s index path.
No declarations were skipped in this snapshot.