New
138struct
BarcodeObservation
NewwatchOSpublic struct BarcodeObservation : VisionObservation, QuadrilateralProviding
Declaration
public struct BarcodeObservation : VisionObservation, QuadrilateralProviding {
public enum CompositeType : Codable, Equatable, Hashable, Sendable {
/// A type that represents trade items in bulk.
case gs1TypeA
/// A type that represents trade items by piece.
case gs1TypeB
/// A type that represents trade items in varying quantity.
case gs1TypeC
/// A type that represents a linked composite type.
case linked
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: BarcodeObservation.CompositeType, b: BarcodeObservation.CompositeType) -> Bool
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Hashes the essential components of this value by feeding them into the
/// given hasher.
///
/// Implement this method to conform to the `Hashable` protocol. The
/// components used for hashing must be the same as the components compared
/// in your type's `==` operator implementation. Call `hasher.combine(_:)`
/// with each of these components.
///
/// - Important: In your implementation of `hash(into:)`,
/// don't call `finalize()` on the `hasher` instance provided,
/// or replace it with a different instance.
/// Doing so may become a compile-time error in the future.
///
/// - Parameter hasher: The hasher to use when combining the components
/// of this instance.
public func hash(into hasher: inout Hasher)
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
/// A string value that represents the barcode payload.
///
/// Depending on the symbology or the payload data itself, a string representation of the payload may not be available.
public let payloadString: String?
/// The raw data representation of the barcode’s payload.
public let payloadData: Data?
Truncated.
extension
BarcodeObservation
NewwatchOSextension BarcodeObservation : Codable
Declaration
extension BarcodeObservation : Codable {
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
struct
BarcodeReaderTool
NewiOSmacOSwatchOSpublic struct BarcodeReaderTool : Tool, @unchecked Sendable
A tool that scans machine-readable codes in an image.
When the model encounters an image containing machine-readable codes, it can call this tool to decode them. The tool returns an array of Barcode results, each containing the decoded content and the symbology type.
To enable this tool, configure your LanguageModelSession with an instance of BarcodeReaderTool.
let barcodeTool = BarcodeReaderTool()
let session = LanguageModelSession(tools: [barcodeTool])
You can override the default name and description to customize how the model identifies and uses the tool.
let customTool = BarcodeReaderTool(
name: "scanQRCode",
description: "Scan QR codes"
)
Declaration
public struct BarcodeReaderTool : Tool, @unchecked Sendable {
/// A unique name for the tool, such as "get_weather", "toggleDarkMode", or "search contacts".
public let name: String
/// A natural language description of when and how to use the tool.
public let description: String
/// Creates a tool for decoding machine-readable codes.
///
/// - Parameters:
/// - name: The name of the tool as exposed to the model. If not provided, a default name is used.
/// - description: A description of what the tool does, used by the model to determine when to call it. If not provided, a default description is used.
public init(name: String? = nil, description: String? = nil)
/// The arguments that this tool should accept.
///
/// Typically arguments are either a ``Generable`` type or ``GeneratedContent``.
public struct Arguments {
/// An instance of the generation schema.
nonisolated public static var generationSchema: GenerationSchema { get }
/// This instance represented as generated content.
///
/// Conformance to this protocol is provided by the `@Generable` macro.
/// A manual implementation may be used to map values onto properties using
/// different names. Use the generated content property as shown below, to
/// manually return a new ``GeneratedContent`` with the properties you specify.
///
/// ```swift
/// struct Person: ConvertibleToGeneratedContent {
/// var name: String
/// var age: Int
///
/// var generatedContent: GeneratedContent {
/// GeneratedContent(properties: [
/// "firstName": name,
/// "ageInYears": age
/// ])
/// }
/// }
/// ```
///
/// - Important: If your type also conforms to ``ConvertibleFromGeneratedContent``,
/// it is critical that this implementation be symmetrical with ``ConvertibleFromGeneratedContent/init(_:)``.
nonisolated public var generatedContent: GeneratedContent { get }
/// A representation of partially generated content
nonisolated public struct PartiallyGenerated : Identifiable, nonisolated ConvertibleFromGeneratedContent {
/// The stable identity of the entity associated with this instance.
public var id: GenerationID
/// Creates an instance from content generated by a model.
///
/// Conformance to this protocol is provided by the `@Generable` macro.
/// A manual implementation may be used to map values onto properties using
/// different names. To manually initialize your type from generated content,
/// decode the values as shown below:
///
/// ```swift
/// struct Person: ConvertibleFromGeneratedContent {
/// var name: String
/// var age: Int
///
/// init(_ content: GeneratedContent) {
/// self.name = try content.value(forProperty: "firstName")
/// self.age = try content.value(forProperty: "ageInYears")
/// }
/// }
/// ```
///
/// - Important: If your type also conforms to ``ConvertibleToGeneratedContent``,
/// it is critical that this implementation be symmetrical with ``ConvertibleToGeneratedContent/generatedContent``.
///
/// - SeeAlso: `@Generable` macro ``Generable(description:)``
nonisolated public init(_ content: GeneratedContent) throws
/// A type representing the stable identity of the entity associated with
Truncated.
extension
BarcodeReaderTool.Arguments
NewiOSmacOSwatchOSextension BarcodeReaderTool.Arguments : nonisolated Generable
Declaration
extension BarcodeReaderTool.Arguments : nonisolated Generable {
/// Creates an instance from content generated by a model.
///
/// Conformance to this protocol is provided by the `@Generable` macro.
/// A manual implementation may be used to map values onto properties using
/// different names. To manually initialize your type from generated content,
/// decode the values as shown below:
///
/// ```swift
/// struct Person: ConvertibleFromGeneratedContent {
/// var name: String
/// var age: Int
///
/// init(_ content: GeneratedContent) {
/// self.name = try content.value(forProperty: "firstName")
/// self.age = try content.value(forProperty: "ageInYears")
/// }
/// }
/// ```
///
/// - Important: If your type also conforms to ``ConvertibleToGeneratedContent``,
/// it is critical that this implementation be symmetrical with ``ConvertibleToGeneratedContent/generatedContent``.
///
/// - SeeAlso: `@Generable` macro ``Generable(description:)``
nonisolated public init(_ content: GeneratedContent) throws
}
enum
BarcodeSymbology
NewwatchOSpublic enum BarcodeSymbology : CaseIterable, Codable, Equatable, Hashable, Sendable
Declaration
public enum BarcodeSymbology : CaseIterable, Codable, Equatable, Hashable, Sendable {
case aztec
case code39
case code39Checksum
case code39FullASCII
case code39FullASCIIChecksum
case code93
case code93i
case code128
case dataMatrix
case ean8
case ean13
case i2of5
case i2of5Checksum
case itf14
case pdf417
case qr
case upce
case codabar
case gs1DataBar
case gs1DataBarExpanded
case gs1DataBarLimited
case microPDF417
case microQR
case msiPlessey
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: BarcodeSymbology, b: BarcodeSymbology) -> Bool
/// A type that can represent a collection of all values of this type.
@available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 27.0, visionOS 2.0, *)
public typealias AllCases = [BarcodeSymbology]
/// A collection of all values of this type.
nonisolated public static var allCases: [BarcodeSymbology] { get }
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Hashes the essential components of this value by feeding them into the
/// given hasher.
Truncated.
protocol
BoundingBoxProviding
NewwatchOSpublic protocol BoundingBoxProviding
A protocol for objects that have a bounding box.
Declaration
public protocol BoundingBoxProviding {
/// The bounding box of the object.
///
/// The coordinate system is normalized to the dimensions of the processed image, with the origin at the lower-left corner of the image.
var boundingBox: NormalizedRect { get }
}
protocol
BoundingRegionProviding
NewwatchOSpublic protocol BoundingRegionProviding
Declaration
public protocol BoundingRegionProviding {
var boundingRegion: NormalizedRegion { get }
}
struct
CalculateImageAestheticsScoresRequest
NewwatchOSpublic struct CalculateImageAestheticsScoresRequest : ImageProcessingRequest
A request that analyzes an image for aesthetically pleasing attributes.
The request returns the resulting aesthetics score in an instance of ImageAestheticsScoresObservation.
Declaration
public struct CalculateImageAestheticsScoresRequest : ImageProcessingRequest {
/// The type produced by performing a Request.
///
/// This type will either be a single VisionObservation or array of VisionObservations.
public typealias Result = ImageAestheticsScoresObservation
public enum Revision : Comparable, Sendable, Equatable, Codable, Hashable {
case revision1
/// Returns a Boolean value indicating whether the value of the first
/// argument is less than that of the second argument.
///
/// This function is the only requirement of the `Comparable` protocol. The
/// remainder of the relational operator functions are implemented by the
/// standard library for any type that conforms to `Comparable`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func < (a: CalculateImageAestheticsScoresRequest.Revision, b: CalculateImageAestheticsScoresRequest.Revision) -> Bool
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: CalculateImageAestheticsScoresRequest.Revision, b: CalculateImageAestheticsScoresRequest.Revision) -> Bool
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Hashes the essential components of this value by feeding them into the
/// given hasher.
///
/// Implement this method to conform to the `Hashable` protocol. The
/// components used for hashing must be the same as the components compared
/// in your type's `==` operator implementation. Call `hasher.combine(_:)`
/// with each of these components.
///
/// - Important: In your implementation of `hash(into:)`,
/// don't call `finalize()` on the `hasher` instance provided,
/// or replace it with a different instance.
/// Doing so may become a compile-time error in the future.
///
/// - Parameter hasher: The hasher to use when combining the components
/// of this instance.
public func hash(into hasher: inout Hasher)
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
Truncated.
extension
CGPoint
NewwatchOSextension CGPoint
Declaration
extension CGPoint {
public var formattedDescription: String { get }
}
extension
CGRect
NewwatchOSextension CGRect
Declaration
extension CGRect {
public var formattedDescription: String { get }
}
extension
CGSize
NewwatchOSextension CGSize
Declaration
extension CGSize {
public var formattedDescription: String { get }
}
struct
ClassificationObservation
NewwatchOSpublic struct ClassificationObservation : VisionObservation, @unchecked Sendable
An object that represents classification information that an image analysis request produces.
Declaration
public struct ClassificationObservation : VisionObservation, @unchecked Sendable {
/// The is the identifier of a classification request. An example classification could be a string like 'cat' or 'hotdog'.
///
/// The string is defined in the model that was used for the classification. Usually these are technical labels that are not localized
/// and not meant to be used directly to be presented to an end user in the UI.
public let identifier: String
/// A Boolean variable indicating whether the observation contains precision and recall curves.
///
/// Precision refers to the percentage of your classification results that are relevant, while recall refers to the percentage of total
/// relevant results correctly classified. If this property is true, then you can call precision and recall-related methods in this observation.
/// If this property is false, then the precision and recall-related methods won't return meaningful data.
public var hasPrecisionRecallCurve: Bool { get }
/// The unique identifier for the observation.
public let uuid: UUID
/// The level of confidence normalized to `[0, 1]` where `1` is most confident.
///
/// The only exception is results coming from `CoreMLRequest`, where confidence values are forwarded as is from relevant CoreML models
public let confidence: Float
/// The time range of the reported observation.
///
/// When evaluating a sequence of image buffers, use this property to determine each observation’s start time and duration.
public let timeRange: CMTimeRange?
/// The descriptor of the request that produced the observation.
public let originatingRequestDescriptor: RequestDescriptor?
/// 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.
public var description: String { get }
/// Determines whether the observation has a minimum recall value for a specific precision.
///
/// - Parameters:
/// - minimumRecall: The minimum desired percentage of relevant results that the algorithm correctly classified.
/// - precision: The percentage of classification results that are relevant.
///
/// - Returns: A Boolean indicating whether or not this classification observation provides a minimum percentage of relevant results that meet the desired precision criterion.
public func hasMinimumRecall(_ minimumRecall: Float, forPrecision precision: Float) -> Bool
/// Determines whether the observation has a minimum precision value for a specific recall.
///
/// - Parameters:
/// - minimumPrecision: The minimum percentage of classification results that are relevant.
/// - recall: The percentage of relevant results that the algorithm correctly classified.
///
/// - Returns: A Boolean indicating whether or not this classification observation provides a minimum percentage of relevant results that meet the desired recall criterion.
public func hasMinimumPrecision(_ minimumPrecision: Float, forRecall recall: Float) -> Bool
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
Truncated.
extension
ClassificationObservation
NewwatchOSextension ClassificationObservation : Codable
Declaration
extension ClassificationObservation : Codable {
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
struct
ClassifyImageRequest
NewwatchOSpublic struct ClassifyImageRequest : ImageProcessingRequest
A request to classify an image.
This type of request produces a collection of ClassificationObservation objects that describe an image. Access the possible classifications through the supportedIdentifiers property.
Declaration
public struct ClassifyImageRequest : ImageProcessingRequest {
/// The type produced by performing a Request.
///
/// This type will either be a single VisionObservation or array of VisionObservations.
public typealias Result = [ClassificationObservation]
public enum Revision : Comparable, Sendable, Equatable, Codable, Hashable {
case revision2
/// Returns a Boolean value indicating whether the value of the first
/// argument is less than that of the second argument.
///
/// This function is the only requirement of the `Comparable` protocol. The
/// remainder of the relational operator functions are implemented by the
/// standard library for any type that conforms to `Comparable`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func < (a: ClassifyImageRequest.Revision, b: ClassifyImageRequest.Revision) -> Bool
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: ClassifyImageRequest.Revision, b: ClassifyImageRequest.Revision) -> Bool
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Hashes the essential components of this value by feeding them into the
/// given hasher.
///
/// Implement this method to conform to the `Hashable` protocol. The
/// components used for hashing must be the same as the components compared
/// in your type's `==` operator implementation. Call `hasher.combine(_:)`
/// with each of these components.
///
/// - Important: In your implementation of `hash(into:)`,
/// don't call `finalize()` on the `hasher` instance provided,
/// or replace it with a different instance.
/// Doing so may become a compile-time error in the future.
///
/// - Parameter hasher: The hasher to use when combining the components
/// of this instance.
public func hash(into hasher: inout Hasher)
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
Truncated.
enum
ComputeStage
NewwatchOSpublic enum ComputeStage : Codable, Equatable, Hashable, Sendable
Types that represent the compute stage.
Declaration
public enum ComputeStage : Codable, Equatable, Hashable, Sendable {
/// A stage that represents where the system performs the main functionality.
case main
/// A stage that represents where the system performs additional analysis after the main compute stage.
case postProcessing
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: ComputeStage, b: ComputeStage) -> Bool
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Hashes the essential components of this value by feeding them into the
/// given hasher.
///
/// Implement this method to conform to the `Hashable` protocol. The
/// components used for hashing must be the same as the components compared
/// in your type's `==` operator implementation. Call `hasher.combine(_:)`
/// with each of these components.
///
/// - Important: In your implementation of `hash(into:)`,
/// don't call `finalize()` on the `hasher` instance provided,
/// or replace it with a different instance.
/// Doing so may become a compile-time error in the future.
///
/// - Parameter hasher: The hasher to use when combining the components
/// of this instance.
public func hash(into hasher: inout Hasher)
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
struct
ContoursObservation
NewwatchOSpublic struct ContoursObservation : VisionObservation, @unchecked Sendable
Declaration
public struct ContoursObservation : VisionObservation, @unchecked Sendable {
/// The total number of detected contours.
///
/// Use this value to determine the number of indices available for calling `contour(at:)`.
public var contourCount: Int { get }
/// The detected contours as a path object in normalized coordinates.
public var normalizedPath: CGPath { get }
/// An array of contours that don’t have another contour enclosing them.
///
/// This array constitutes the top of the contour hierarchy. You can iterate over each VNContour instance to determine its children.
public var topLevelContours: [ContoursObservation.Contour] { get }
/// The unique identifier for the observation.
public let uuid: UUID
/// The level of confidence normalized to `[0, 1]` where `1` is most confident.
///
/// The only exception is results coming from `CoreMLRequest`, where confidence values are forwarded as is from relevant CoreML models
public let confidence: Float
/// The time range of the reported observation.
///
/// When evaluating a sequence of image buffers, use this property to determine each observation’s start time and duration.
public let timeRange: CMTimeRange?
/// The descriptor of the request that produced the observation.
public let originatingRequestDescriptor: RequestDescriptor?
/// 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.
public var description: String { get }
/// Retrieves the contour object at the specified index, irrespective of hierarchy.
///
/// - Parameters:
/// - contourIndex: The index of the contour to retrieve. Valid values are in the range of 0 to contourCount - 1.
/// - Returns: The contour object at the specified index path, or `nil` if the index path is invalid.
public func contourAtIndex(_ index: Int) -> ContoursObservation.Contour?
/// Retrieves the contour object at the specified index path.
///
/// - Parameters:
/// - indexPath: The hierarchical index path to the contour.
/// - Returns: The contour object at the specified index, or `nil` if the index is invalid.
public func countourAtIndexPath(_ indexPath: IndexPath) -> ContoursObservation.Contour?
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: ContoursObservation, b: ContoursObservation) -> Bool
Truncated.
extension
ContoursObservation
NewwatchOSextension ContoursObservation
Declaration
extension ContoursObservation {
public struct Contour : @unchecked Sendable, Equatable, Hashable, CustomStringConvertible {
/// The aspect ratio of the contour.
///
/// The aspect ratio is the original image’s width divided by its height.
public var aspectRatio: Float { get }
/// The contour object’s index path.
public var indexPath: IndexPath { get }
/// The contour object as a path in normalized coordinates.
public var normalizedPath: CGPath { get }
/// The contour’s number of points.
public var pointCount: Int { get }
/// The contour’s array of points in normalized coordinates.
public var normalizedPoints: [simd_float2] { get }
/// An array of contours that this contour encloses.
public var childContours: [ContoursObservation.Contour] { 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.
public var description: String { get }
/// 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.
public func calculateArea(useOrientedArea: Bool = false) -> Double
/// Calculate the perimeter of the contour.
public func calculatePerimeter() -> Double
/// Creates a Circle that encloses the contour.
public func boundingCircle() -> NormalizedCircle
/// 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.
public func polygonApproximation(epsilon: Float) throws -> ContoursObservation.Contour
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: ContoursObservation.Contour, b: ContoursObservation.Contour) -> Bool
Truncated.
extension
ContoursObservation
NewwatchOSextension ContoursObservation : Codable
Declaration
extension ContoursObservation : Codable {
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
extension
ContoursObservation.Contour
NewwatchOSextension ContoursObservation.Contour
Declaration
extension ContoursObservation.Contour {
/// The points of the region as an array of `NormalizedPoint`.
public var points: [NormalizedPoint] { get }
/// The bounding quadrilateral of the region.
public var boundingQuad: RectangleObservation { get }
/// The bounding box of the region.
public var boundingBox: NormalizedRect { get }
}
enum
CoordinateOrigin
NewwatchOSpublic enum CoordinateOrigin
Declaration
public enum CoordinateOrigin {
/// The origin is in the upper-left corner of the image
case upperLeft
/// The origin is in the lower-left corner of the image
case lowerLeft
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: CoordinateOrigin, b: CoordinateOrigin) -> Bool
/// Hashes the essential components of this value by feeding them into the
/// given hasher.
///
/// Implement this method to conform to the `Hashable` protocol. The
/// components used for hashing must be the same as the components compared
/// in your type's `==` operator implementation. Call `hasher.combine(_:)`
/// with each of these components.
///
/// - Important: In your implementation of `hash(into:)`,
/// don't call `finalize()` on the `hasher` instance provided,
/// or replace it with a different instance.
/// Doing so may become a compile-time error in the future.
///
/// - Parameter hasher: The hasher to use when combining the components
/// of this instance.
public func hash(into hasher: inout Hasher)
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
}
extension
CoordinateOrigin
NewwatchOSextension CoordinateOrigin : Equatable
Declaration
extension CoordinateOrigin : Equatable {
}
extension
CoordinateOrigin
NewwatchOSextension CoordinateOrigin : Hashable
Declaration
extension CoordinateOrigin : Hashable {
}
struct
CoreMLFeatureValueObservation
NewwatchOSpublic struct CoreMLFeatureValueObservation : VisionObservation
Declaration
public struct CoreMLFeatureValueObservation : VisionObservation {
/// The name used in the model description of the CoreML model that produced this observation.
public let featureName: String
/// The feature result of a ``CoreMLRequest`` that outputs neither a classification nor an image.
///
/// Refer to Core ML documentation and the model itself to learn about proper handling of the content.
public let featureValue: MLSendableFeatureValue
/// The unique identifier for the observation.
public let uuid: UUID
/// The level of confidence normalized to `[0, 1]` where `1` is most confident.
///
/// The only exception is results coming from `CoreMLRequest`, where confidence values are forwarded as is from relevant CoreML models
public let confidence: Float
/// The time range of the reported observation.
///
/// When evaluating a sequence of image buffers, use this property to determine each observation’s start time and duration.
public let timeRange: CMTimeRange?
/// The descriptor of the request that produced the observation.
public let originatingRequestDescriptor: RequestDescriptor?
/// 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.
public var description: String { get }
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: CoreMLFeatureValueObservation, b: CoreMLFeatureValueObservation) -> Bool
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
}
extension
CoreMLFeatureValueObservation
NewwatchOSextension CoreMLFeatureValueObservation : Codable
Declaration
extension CoreMLFeatureValueObservation : Codable {
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
struct
CoreMLModelContainer
NewwatchOSpublic struct CoreMLModelContainer : Equatable, @unchecked Sendable, Hashable
A model container to use with an image analysis request.
Declaration
public struct CoreMLModelContainer : Equatable, @unchecked Sendable, Hashable {
/// Creates a model container to use with an image analysis request based on the model you provide.
///
/// - Parameters:
/// - model: The Core ML model on which to base the Vision request.
///
/// Initialization can fail if the Core ML model you provide isn’t supported in Vision, such as if the model doesn’t accept an image as input.
public init(model: MLModel, featureProvider: (any MLFeatureProvider)? = nil) throws
/// The name of the `MLFeatureValue` that Vision sets from the request handler.
///
/// By default, Vision uses the first input found, but you can manually set that input to another `featureName` instead.
public var inputImageFeatureName: String
/// Hashes the essential components of this value by feeding them into the
/// given hasher.
///
/// Implement this method to conform to the `Hashable` protocol. The
/// components used for hashing must be the same as the components compared
/// in your type's `==` operator implementation. Call `hasher.combine(_:)`
/// with each of these components.
///
/// - Important: In your implementation of `hash(into:)`,
/// don't call `finalize()` on the `hasher` instance provided,
/// or replace it with a different instance.
/// Doing so may become a compile-time error in the future.
///
/// - Parameter hasher: The hasher to use when combining the components
/// of this instance.
public func hash(into hasher: inout Hasher)
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (lhs: CoreMLModelContainer, rhs: CoreMLModelContainer) -> Bool
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
}
struct
CoreMLRequest
NewwatchOSpublic struct CoreMLRequest : ImageProcessingRequest
An image analysis request that uses a Core ML model to process images.
The results array of a Core ML-based image analysis request contains a different observation type, depending on the kind of MLModel object you use:
- If the model predicts a single feature, the model’s
modelDescription object has a non-nil value for predictedFeatureName and Vision treats the model as a classifier. The results are ClassificationObservation objects. - If the model’s outputs include at least one output with a feature type of
MLFeatureType.image, Vision treats that model as an image-to-image model. The results are PixelBufferObservation objects. - Otherwise, Vision treats the model as a general predictor model. The results are
CoreMLFeatureValueObservation objects.
Note: Vision forwards all confidence values from Core ML models as-is and doesn’t normalize them to [0, 1].
Declaration
public struct CoreMLRequest : ImageProcessingRequest {
/// The type produced by performing a Request.
///
/// This type will either be a single VisionObservation or array of VisionObservations.
public typealias Result = [any VisionObservation]
public enum Revision : Comparable, Sendable, Equatable, Codable, Hashable {
case revision1
/// Returns a Boolean value indicating whether the value of the first
/// argument is less than that of the second argument.
///
/// This function is the only requirement of the `Comparable` protocol. The
/// remainder of the relational operator functions are implemented by the
/// standard library for any type that conforms to `Comparable`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func < (a: CoreMLRequest.Revision, b: CoreMLRequest.Revision) -> Bool
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: CoreMLRequest.Revision, b: CoreMLRequest.Revision) -> Bool
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Hashes the essential components of this value by feeding them into the
/// given hasher.
///
/// Implement this method to conform to the `Hashable` protocol. The
/// components used for hashing must be the same as the components compared
/// in your type's `==` operator implementation. Call `hasher.combine(_:)`
/// with each of these components.
///
/// - Important: In your implementation of `hash(into:)`,
/// don't call `finalize()` on the `hasher` instance provided,
/// or replace it with a different instance.
/// Doing so may become a compile-time error in the future.
///
/// - Parameter hasher: The hasher to use when combining the components
/// of this instance.
public func hash(into hasher: inout Hasher)
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
Truncated.
struct
DetectBarcodesRequest
NewwatchOSpublic struct DetectBarcodesRequest : ImageProcessingRequest
A request that detects barcodes in an image.
This request returns an array of BarcodeObservation objects, one for each barcode it detects.
Declaration
public struct DetectBarcodesRequest : ImageProcessingRequest {
/// The type produced by performing a Request.
///
/// This type will either be a single VisionObservation or array of VisionObservations.
public typealias Result = [BarcodeObservation]
public enum Revision : Comparable, Sendable, Equatable, Codable, Hashable {
case revision4
/// Returns a Boolean value indicating whether the value of the first
/// argument is less than that of the second argument.
///
/// This function is the only requirement of the `Comparable` protocol. The
/// remainder of the relational operator functions are implemented by the
/// standard library for any type that conforms to `Comparable`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func < (a: DetectBarcodesRequest.Revision, b: DetectBarcodesRequest.Revision) -> Bool
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: DetectBarcodesRequest.Revision, b: DetectBarcodesRequest.Revision) -> Bool
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Hashes the essential components of this value by feeding them into the
/// given hasher.
///
/// Implement this method to conform to the `Hashable` protocol. The
/// components used for hashing must be the same as the components compared
/// in your type's `==` operator implementation. Call `hasher.combine(_:)`
/// with each of these components.
///
/// - Important: In your implementation of `hash(into:)`,
/// don't call `finalize()` on the `hasher` instance provided,
/// or replace it with a different instance.
/// Doing so may become a compile-time error in the future.
///
/// - Parameter hasher: The hasher to use when combining the components
/// of this instance.
public func hash(into hasher: inout Hasher)
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
Truncated.
struct
DetectContoursRequest
NewwatchOSpublic struct DetectContoursRequest : ImageProcessingRequest
A request that detects the contours of the edges of an image.
Declaration
public struct DetectContoursRequest : ImageProcessingRequest {
/// The type produced by performing a Request.
///
/// This type will either be a single VisionObservation or array of VisionObservations.
public typealias Result = ContoursObservation
public enum Revision : Comparable, Sendable, Equatable, Codable, Hashable {
case revision1
/// Returns a Boolean value indicating whether the value of the first
/// argument is less than that of the second argument.
///
/// This function is the only requirement of the `Comparable` protocol. The
/// remainder of the relational operator functions are implemented by the
/// standard library for any type that conforms to `Comparable`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func < (a: DetectContoursRequest.Revision, b: DetectContoursRequest.Revision) -> Bool
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: DetectContoursRequest.Revision, b: DetectContoursRequest.Revision) -> Bool
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Hashes the essential components of this value by feeding them into the
/// given hasher.
///
/// Implement this method to conform to the `Hashable` protocol. The
/// components used for hashing must be the same as the components compared
/// in your type's `==` operator implementation. Call `hasher.combine(_:)`
/// with each of these components.
///
/// - Important: In your implementation of `hash(into:)`,
/// don't call `finalize()` on the `hasher` instance provided,
/// or replace it with a different instance.
/// Doing so may become a compile-time error in the future.
///
/// - Parameter hasher: The hasher to use when combining the components
/// of this instance.
public func hash(into hasher: inout Hasher)
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
Truncated.
struct
DetectDocumentSegmentationRequest
NewwatchOSpublic struct DetectDocumentSegmentationRequest : ImageProcessingRequest
A request that detects rectangular regions that contain text in the input image.
Perform this request to detect a document in an image. The result that the request generates contains the four corner points of a document’s quadrilateral and saliency mask.
Declaration
public struct DetectDocumentSegmentationRequest : ImageProcessingRequest {
/// The type produced by performing a Request.
///
/// This type will either be a single VisionObservation or array of VisionObservations.
public typealias Result = DetectedDocumentObservation?
public enum Revision : Comparable, Sendable, Equatable, Codable, Hashable {
case revision1
/// Returns a Boolean value indicating whether the value of the first
/// argument is less than that of the second argument.
///
/// This function is the only requirement of the `Comparable` protocol. The
/// remainder of the relational operator functions are implemented by the
/// standard library for any type that conforms to `Comparable`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func < (a: DetectDocumentSegmentationRequest.Revision, b: DetectDocumentSegmentationRequest.Revision) -> Bool
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: DetectDocumentSegmentationRequest.Revision, b: DetectDocumentSegmentationRequest.Revision) -> Bool
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Hashes the essential components of this value by feeding them into the
/// given hasher.
///
/// Implement this method to conform to the `Hashable` protocol. The
/// components used for hashing must be the same as the components compared
/// in your type's `==` operator implementation. Call `hasher.combine(_:)`
/// with each of these components.
///
/// - Important: In your implementation of `hash(into:)`,
/// don't call `finalize()` on the `hasher` instance provided,
/// or replace it with a different instance.
/// Doing so may become a compile-time error in the future.
///
/// - Parameter hasher: The hasher to use when combining the components
/// of this instance.
public func hash(into hasher: inout Hasher)
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
Truncated.
struct
DetectedDocumentObservation
NewwatchOSpublic struct DetectedDocumentObservation : VisionObservation, QuadrilateralProviding
An observation that contains a detected document.
The observation includes the four corner points of a document’s quadrilateral and saliency mask.
Declaration
public struct DetectedDocumentObservation : VisionObservation, QuadrilateralProviding {
/// A pixel buffer representing a segmentation mask for the detected document.
public var globalSegmentationMask: PixelBufferObservation
/// The coordinates of the upper-left corner of the quadrilateral.
public var topLeft: NormalizedPoint
/// The coordinates of the upper-right corner of the quadrilateral.
public var topRight: NormalizedPoint
/// The coordinates of the lower-right corner of the quadrilateral.
public var bottomRight: NormalizedPoint
/// The coordinates of the lower-left corner of the quadrilateral.
public var bottomLeft: NormalizedPoint
/// The unique identifier for the observation.
public let uuid: UUID
/// The level of confidence normalized to `[0, 1]` where `1` is most confident.
///
/// The only exception is results coming from `CoreMLRequest`, where confidence values are forwarded as is from relevant CoreML models
public let confidence: Float
/// The time range of the reported observation.
///
/// When evaluating a sequence of image buffers, use this property to determine each observation’s start time and duration.
public let timeRange: CMTimeRange?
/// 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.
public var description: String { get }
/// The descriptor of the request that produced the observation.
public let originatingRequestDescriptor: RequestDescriptor?
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: DetectedDocumentObservation, b: DetectedDocumentObservation) -> Bool
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
}
extension
DetectedDocumentObservation
NewwatchOSextension DetectedDocumentObservation : Codable
Declaration
extension DetectedDocumentObservation : Codable {
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
struct
DetectedObjectObservation
NewwatchOSpublic struct DetectedObjectObservation : VisionObservation, BoundingBoxProviding
An observation that provides the position and extent of an image feature that an image analysis request detects.
This class is the observation type that TrackObjectRequest generates. It represents an object that the Vision request detects and tracks.
Declaration
public struct DetectedObjectObservation : VisionObservation, BoundingBoxProviding {
public init(boundingBox: NormalizedRect)
/// The bounding box of the object.
///
/// The coordinate system is normalized to the dimensions of the processed image, with the origin at the lower-left corner of the image.
public var boundingBox: NormalizedRect
/// The unique identifier for the observation.
public let uuid: UUID
/// The level of confidence normalized to `[0, 1]` where `1` is most confident.
///
/// The only exception is results coming from `CoreMLRequest`, where confidence values are forwarded as is from relevant CoreML models
public let confidence: Float
/// The time range of the reported observation.
///
/// When evaluating a sequence of image buffers, use this property to determine each observation’s start time and duration.
public let timeRange: CMTimeRange?
/// The descriptor of the request that produced the observation.
public let originatingRequestDescriptor: RequestDescriptor?
/// 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.
public var description: String { get }
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: DetectedObjectObservation, b: DetectedObjectObservation) -> Bool
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
}
extension
DetectedObjectObservation
NewwatchOSextension DetectedObjectObservation : Codable
Declaration
extension DetectedObjectObservation : Codable {
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
struct
DetectFaceCaptureQualityRequest
NewwatchOSpublic struct DetectFaceCaptureQualityRequest : ImageProcessingRequest
A request that determines the capture quality of faces in a photo.
This request produces one FaceObservation object for each face analyzed. The FaceObservation will have a non-nil captureQuality containing a score that ranges in value from 0 to 1. Faces with quality closer to 1 are better lit, sharper, and more centrally positioned than faces with quality closer to 0.
By default, a capture quality request first locates all faces in the input image, then analyzes each to detect capture quality. If you’ve already located all the faces in an image, or want to detect capture quality in only a subset of the faces in the image, set the inputFaceObservations property to an array of FaceObservation objects representing the faces you want to analyze. You can either use face observations output by a DetectFaceRectanglesRequest or manually create FaceObservation instances with the bounding boxes of the faces you want to analyze.
Declaration
public struct DetectFaceCaptureQualityRequest : ImageProcessingRequest {
/// The type produced by performing a Request.
///
/// This type will either be a single VisionObservation or array of VisionObservations.
public typealias Result = [FaceObservation]
public enum Revision : Comparable, Sendable, Equatable, Codable, Hashable {
case revision3
/// Returns a Boolean value indicating whether the value of the first
/// argument is less than that of the second argument.
///
/// This function is the only requirement of the `Comparable` protocol. The
/// remainder of the relational operator functions are implemented by the
/// standard library for any type that conforms to `Comparable`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func < (a: DetectFaceCaptureQualityRequest.Revision, b: DetectFaceCaptureQualityRequest.Revision) -> Bool
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: DetectFaceCaptureQualityRequest.Revision, b: DetectFaceCaptureQualityRequest.Revision) -> Bool
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Hashes the essential components of this value by feeding them into the
/// given hasher.
///
/// Implement this method to conform to the `Hashable` protocol. The
/// components used for hashing must be the same as the components compared
/// in your type's `==` operator implementation. Call `hasher.combine(_:)`
/// with each of these components.
///
/// - Important: In your implementation of `hash(into:)`,
/// don't call `finalize()` on the `hasher` instance provided,
/// or replace it with a different instance.
/// Doing so may become a compile-time error in the future.
///
/// - Parameter hasher: The hasher to use when combining the components
/// of this instance.
public func hash(into hasher: inout Hasher)
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
Truncated.
struct
DetectFaceLandmarksRequest
NewwatchOSpublic struct DetectFaceLandmarksRequest : ImageProcessingRequest
An image analysis request that finds facial features like eyes and mouth in an image.
By default, a face landmarks request first locates all faces in the input image, then analyzes each to detect facial features. If you’ve already located all the faces in an image, or want to detect landmarks in only a subset of the faces in the image, set the inputFaceObservations property to an array of FaceObservation objects representing the faces you want to analyze. You can either use face observations output by a DetectFaceRectanglesRequest or manually create FaceObservation instances with the bounding boxes of the faces you want to analyze.
Declaration
public struct DetectFaceLandmarksRequest : ImageProcessingRequest {
/// The type produced by performing a Request.
///
/// This type will either be a single VisionObservation or array of VisionObservations.
public typealias Result = [FaceObservation]
public enum Revision : Comparable, Sendable, Equatable, Codable, Hashable {
case revision3
@available(macOS 27.0, iOS 27.0, tvOS 27.0, *)
case revision4
/// Returns a Boolean value indicating whether the value of the first
/// argument is less than that of the second argument.
///
/// This function is the only requirement of the `Comparable` protocol. The
/// remainder of the relational operator functions are implemented by the
/// standard library for any type that conforms to `Comparable`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func < (lhs: DetectFaceLandmarksRequest.Revision, rhs: DetectFaceLandmarksRequest.Revision) -> Bool
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: DetectFaceLandmarksRequest.Revision, b: DetectFaceLandmarksRequest.Revision) -> Bool
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Hashes the essential components of this value by feeding them into the
/// given hasher.
///
/// Implement this method to conform to the `Hashable` protocol. The
/// components used for hashing must be the same as the components compared
/// in your type's `==` operator implementation. Call `hasher.combine(_:)`
/// with each of these components.
///
/// - Important: In your implementation of `hash(into:)`,
/// don't call `finalize()` on the `hasher` instance provided,
/// or replace it with a different instance.
/// Doing so may become a compile-time error in the future.
///
/// - Parameter hasher: The hasher to use when combining the components
/// of this instance.
public func hash(into hasher: inout Hasher)
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
Truncated.
struct
DetectFaceRectanglesRequest
NewwatchOSpublic struct DetectFaceRectanglesRequest : ImageProcessingRequest
A request that finds faces within an image.
This request returns faces as rectangular bounding boxes with origin and size.
Declaration
public struct DetectFaceRectanglesRequest : ImageProcessingRequest {
/// The type produced by performing a Request.
///
/// This type will either be a single VisionObservation or array of VisionObservations.
public typealias Result = [FaceObservation]
public enum Revision : Comparable, Sendable, Equatable, Codable, Hashable {
case revision3
@available(macOS 27.0, iOS 27.0, tvOS 27.0, *)
case revision4
/// Returns a Boolean value indicating whether the value of the first
/// argument is less than that of the second argument.
///
/// This function is the only requirement of the `Comparable` protocol. The
/// remainder of the relational operator functions are implemented by the
/// standard library for any type that conforms to `Comparable`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func < (lhs: DetectFaceRectanglesRequest.Revision, rhs: DetectFaceRectanglesRequest.Revision) -> Bool
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: DetectFaceRectanglesRequest.Revision, b: DetectFaceRectanglesRequest.Revision) -> Bool
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Hashes the essential components of this value by feeding them into the
/// given hasher.
///
/// Implement this method to conform to the `Hashable` protocol. The
/// components used for hashing must be the same as the components compared
/// in your type's `==` operator implementation. Call `hasher.combine(_:)`
/// with each of these components.
///
/// - Important: In your implementation of `hash(into:)`,
/// don't call `finalize()` on the `hasher` instance provided,
/// or replace it with a different instance.
/// Doing so may become a compile-time error in the future.
///
/// - Parameter hasher: The hasher to use when combining the components
/// of this instance.
public func hash(into hasher: inout Hasher)
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
Truncated.
struct
DetectHorizonRequest
NewwatchOSpublic struct DetectHorizonRequest : ImageProcessingRequest
An image analysis request that determines the horizon angle in an image.
Declaration
public struct DetectHorizonRequest : ImageProcessingRequest {
/// The type produced by performing a Request.
///
/// This type will either be a single VisionObservation or array of VisionObservations.
public typealias Result = HorizonObservation?
public enum Revision : Comparable, Sendable, Equatable, Codable, Hashable {
case revision1
/// Returns a Boolean value indicating whether the value of the first
/// argument is less than that of the second argument.
///
/// This function is the only requirement of the `Comparable` protocol. The
/// remainder of the relational operator functions are implemented by the
/// standard library for any type that conforms to `Comparable`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func < (a: DetectHorizonRequest.Revision, b: DetectHorizonRequest.Revision) -> Bool
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: DetectHorizonRequest.Revision, b: DetectHorizonRequest.Revision) -> Bool
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Hashes the essential components of this value by feeding them into the
/// given hasher.
///
/// Implement this method to conform to the `Hashable` protocol. The
/// components used for hashing must be the same as the components compared
/// in your type's `==` operator implementation. Call `hasher.combine(_:)`
/// with each of these components.
///
/// - Important: In your implementation of `hash(into:)`,
/// don't call `finalize()` on the `hasher` instance provided,
/// or replace it with a different instance.
/// Doing so may become a compile-time error in the future.
///
/// - Parameter hasher: The hasher to use when combining the components
/// of this instance.
public func hash(into hasher: inout Hasher)
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
Truncated.
struct
DetectHumanRectanglesRequest
NewwatchOSpublic struct DetectHumanRectanglesRequest : ImageProcessingRequest
A request that finds rectangular regions that contain people in an image.
Declaration
public struct DetectHumanRectanglesRequest : ImageProcessingRequest {
/// The type produced by performing a Request.
///
/// This type will either be a single VisionObservation or array of VisionObservations.
public typealias Result = [HumanObservation]
public enum Revision : Comparable, Sendable, Equatable, Codable, Hashable {
case revision2
@available(macOS 27.0, iOS 27.0, tvOS 27.0, *)
case revision3
/// Returns a Boolean value indicating whether the value of the first
/// argument is less than that of the second argument.
///
/// This function is the only requirement of the `Comparable` protocol. The
/// remainder of the relational operator functions are implemented by the
/// standard library for any type that conforms to `Comparable`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func < (lhs: DetectHumanRectanglesRequest.Revision, rhs: DetectHumanRectanglesRequest.Revision) -> Bool
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: DetectHumanRectanglesRequest.Revision, b: DetectHumanRectanglesRequest.Revision) -> Bool
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Hashes the essential components of this value by feeding them into the
/// given hasher.
///
/// Implement this method to conform to the `Hashable` protocol. The
/// components used for hashing must be the same as the components compared
/// in your type's `==` operator implementation. Call `hasher.combine(_:)`
/// with each of these components.
///
/// - Important: In your implementation of `hash(into:)`,
/// don't call `finalize()` on the `hasher` instance provided,
/// or replace it with a different instance.
/// Doing so may become a compile-time error in the future.
///
/// - Parameter hasher: The hasher to use when combining the components
/// of this instance.
public func hash(into hasher: inout Hasher)
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
Truncated.
struct
DetectLensSmudgeRequest
NewwatchOSpublic struct DetectLensSmudgeRequest : ImageProcessingRequest
A request that detects a smudge on a lens from an image or video frame capture.
Declaration
public struct DetectLensSmudgeRequest : ImageProcessingRequest {
/// The type produced by performing a Request.
///
/// This type will either be a single VisionObservation or array of VisionObservations.
public typealias Result = SmudgeObservation
/// A type that describes the algorithm or implementation that the request performs.
public enum Revision : Comparable, Sendable, Equatable, Codable, Hashable {
/// An algorithm or implementation that represents the first revision.
case revision1
/// Returns a Boolean value indicating whether the value of the first
/// argument is less than that of the second argument.
///
/// This function is the only requirement of the `Comparable` protocol. The
/// remainder of the relational operator functions are implemented by the
/// standard library for any type that conforms to `Comparable`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func < (a: DetectLensSmudgeRequest.Revision, b: DetectLensSmudgeRequest.Revision) -> Bool
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: DetectLensSmudgeRequest.Revision, b: DetectLensSmudgeRequest.Revision) -> Bool
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Hashes the essential components of this value by feeding them into the
/// given hasher.
///
/// Implement this method to conform to the `Hashable` protocol. The
/// components used for hashing must be the same as the components compared
/// in your type's `==` operator implementation. Call `hasher.combine(_:)`
/// with each of these components.
///
/// - Important: In your implementation of `hash(into:)`,
/// don't call `finalize()` on the `hasher` instance provided,
/// or replace it with a different instance.
/// Doing so may become a compile-time error in the future.
///
/// - Parameter hasher: The hasher to use when combining the components
/// of this instance.
public func hash(into hasher: inout Hasher)
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
Truncated.
struct
DetectRectanglesRequest
NewwatchOSpublic struct DetectRectanglesRequest : ImageProcessingRequest
An image-analysis request that finds projected rectangular regions in an image.
A rectangle-detection request locates regions of an image with a rectangular shape, like credit cards, business cards, documents, and signs. The request returns its observations in the form of RectangleObservation objects, which contain normalized coordinates of bounding boxes containing a 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 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.
Declaration
public struct DetectRectanglesRequest : ImageProcessingRequest {
/// The type produced by performing a Request.
///
/// This type will either be a single VisionObservation or array of VisionObservations.
public typealias Result = [RectangleObservation]
public enum Revision : Comparable, Sendable, Equatable, Codable, Hashable {
case revision1
/// Returns a Boolean value indicating whether the value of the first
/// argument is less than that of the second argument.
///
/// This function is the only requirement of the `Comparable` protocol. The
/// remainder of the relational operator functions are implemented by the
/// standard library for any type that conforms to `Comparable`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func < (a: DetectRectanglesRequest.Revision, b: DetectRectanglesRequest.Revision) -> Bool
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: DetectRectanglesRequest.Revision, b: DetectRectanglesRequest.Revision) -> Bool
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Hashes the essential components of this value by feeding them into the
/// given hasher.
///
/// Implement this method to conform to the `Hashable` protocol. The
/// components used for hashing must be the same as the components compared
/// in your type's `==` operator implementation. Call `hasher.combine(_:)`
/// with each of these components.
///
/// - Important: In your implementation of `hash(into:)`,
/// don't call `finalize()` on the `hasher` instance provided,
/// or replace it with a different instance.
/// Doing so may become a compile-time error in the future.
///
/// - Parameter hasher: The hasher to use when combining the components
/// of this instance.
public func hash(into hasher: inout Hasher)
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
Truncated.
struct
DownloadableAssetsProgress
NewvisionOSpublic struct DownloadableAssetsProgress : AsyncSequence, AsyncIteratorProtocol
Declaration
public struct DownloadableAssetsProgress : AsyncSequence, AsyncIteratorProtocol {
/// The type of asynchronous iterator that produces elements of this
/// asynchronous sequence.
public typealias AsyncIterator = DownloadableAssetsProgress
/// The type of element produced by this asynchronous sequence.
public typealias Element = DownloadableAssetsRequestStatus
/// Asynchronously advances to the next element and returns it, or ends the
/// sequence if there is no next element.
///
/// - Returns: The next element, if it exists, or `nil` to signal the end of
/// the sequence.
public mutating func next() async -> DownloadableAssetsRequestStatus?
/// Creates the asynchronous iterator that produces elements of this
/// asynchronous sequence.
///
/// - Returns: An instance of the `AsyncIterator` type used to produce
/// elements of the asynchronous sequence.
public func makeAsyncIterator() -> DownloadableAssetsProgress
}
protocol
DownloadableAssetsRequest
NewiOSmacOStvOSpublic protocol DownloadableAssetsRequest
Declaration
public protocol DownloadableAssetsRequest {
func downloadAssets() async throws
var assetStatus: DownloadableAssetsRequestStatus { get async }
func downloadAssets(progress: consuming Subprogress) async throws
}
extension
DownloadableAssetsRequest
NewiOSmacOStvOSextension DownloadableAssetsRequest
Declaration
extension DownloadableAssetsRequest {
public func downloadAssets() async throws
public func downloadAssets(progress: consuming Subprogress) async throws
}
enum
DownloadableAssetsRequestStatus
NewiOSmacOStvOSpublic enum DownloadableAssetsRequestStatus : Sendable, Equatable
Declaration
public enum DownloadableAssetsRequestStatus : Sendable, Equatable {
case notReady
case ready
case error(any Error)
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (lhs: DownloadableAssetsRequestStatus, rhs: DownloadableAssetsRequestStatus) -> Bool
}
enum
ElementType
NewwatchOSpublic enum ElementType : Codable, Equatable, Hashable, Sendable
An enumeration of the type of element in feature print data.
Declaration
public enum ElementType : Codable, Equatable, Hashable, Sendable {
/// The elements are floating-point numbers.
case float
/// The elements are double-precision floating-point numbers.
case double
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: ElementType, b: ElementType) -> Bool
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Hashes the essential components of this value by feeding them into the
/// given hasher.
///
/// Implement this method to conform to the `Hashable` protocol. The
/// components used for hashing must be the same as the components compared
/// in your type's `==` operator implementation. Call `hasher.combine(_:)`
/// with each of these components.
///
/// - Important: In your implementation of `hash(into:)`,
/// don't call `finalize()` on the `hasher` instance provided,
/// or replace it with a different instance.
/// Doing so may become a compile-time error in the future.
///
/// - Parameter hasher: The hasher to use when combining the components
/// of this instance.
public func hash(into hasher: inout Hasher)
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
func
excludePoint
NewvisionOSfinal public func excludePoint(_ point: NormalizedPoint)
struct
FaceObservation
NewwatchOSpublic struct FaceObservation : VisionObservation, BoundingBoxProviding
Declaration
public struct FaceObservation : VisionObservation, BoundingBoxProviding {
/// - Parameters:
/// - boundingBox: The bounding rectangle of the detected face.
/// - revision: The revision of the `DetectFaceRectanglesRequest` that provided the bounding box.
///
/// If no revision is provided, a default value is assumed. Different revisions can affect how the bounding box is interpreted by Vision.
public init(boundingBox: NormalizedRect, revision: DetectFaceRectanglesRequest.Revision? = nil)
/// The facial features of the detected face.
///
/// This value is nil for face observations produced by a `DetectFaceRectanglesRequest` analysis.
/// Use the `DetectFaceLandmarksRequest` class to find facial features.
public var landmarks: FaceObservation.Landmarks2D?
/// The roll angle of a face.
///
/// This value indicates the rotational angle of the face around the z-axis.
public let roll: Measurement<UnitAngle>
/// The yaw angle of a face.
///
/// This value indicates the rotational angle of the face around the y-axis.
public let yaw: Measurement<UnitAngle>
/// The pitch angle of a face.
///
/// This value indicates the rotational angle of the face around the x-axis.
public let pitch: Measurement<UnitAngle>
/// The quality of the face capture.
///
/// This value is nil for face observations produced by a `DetectFaceRectanglesRequest` analysis.
/// Use ``DetectFaceCaptureQualityRequest`` to detect capture quality.
public var captureQuality: FaceObservation.CaptureQuality?
/// The bounding box of the object.
///
/// The coordinate system is normalized to the dimensions of the processed image, with the origin at the lower-left corner of the image.
public var boundingBox: NormalizedRect
/// The unique identifier for the observation.
public let uuid: UUID
/// The level of confidence normalized to `[0, 1]` where `1` is most confident.
///
/// The only exception is results coming from `CoreMLRequest`, where confidence values are forwarded as is from relevant CoreML models
public let confidence: Float
/// The time range of the reported observation.
///
/// When evaluating a sequence of image buffers, use this property to determine each observation’s start time and duration.
public let timeRange: CMTimeRange?
/// The descriptor of the request that produced the observation.
public let originatingRequestDescriptor: RequestDescriptor?
/// 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.
Truncated.
extension
FaceObservation
NewwatchOSextension FaceObservation
Declaration
extension FaceObservation {
/// A collection of facial features that a request detects.
///
/// This class represents the set of all detectable 2D face landmarks and regions, exposed as properties. The coordinates of the face landmarks are normalized to the dimensions of the face observation’s `boundingBox`, with the origin at the bounding box’s lower-left corner.
public struct Landmarks2D : Codable, Equatable, Sendable, CustomStringConvertible, Hashable {
///
public var allPoints: FaceObservation.Landmarks2D.Region { get }
/// The region containing points that trace the face contour from the left cheek, over the chin, to the right cheek.
public var faceContour: FaceObservation.Landmarks2D.Region { get }
/// The region containing points that outline the left eye.
public var leftEye: FaceObservation.Landmarks2D.Region { get }
/// The region containing points that outline the right eye.
public var rightEye: FaceObservation.Landmarks2D.Region { get }
/// The region containing points that trace the left eyebrow.
public var leftEyebrow: FaceObservation.Landmarks2D.Region { get }
/// The region containing points that trace the right eyebrow.
public var rightEyebrow: FaceObservation.Landmarks2D.Region { get }
/// The region containing points that outline the nose.
public var nose: FaceObservation.Landmarks2D.Region { get }
/// The region containing points that trace the center crest of the nose.
public var noseCrest: FaceObservation.Landmarks2D.Region { get }
/// The region containing points that trace a vertical line down the center of the face.
public var medianLine: FaceObservation.Landmarks2D.Region { get }
/// The region containing points that outline the outside of the lips.
public var outerLips: FaceObservation.Landmarks2D.Region { get }
/// The region containing points that outline the space between the lips.
public var innerLips: FaceObservation.Landmarks2D.Region { get }
/// The region containing the point where the left pupil is located.
public var leftPupil: FaceObservation.Landmarks2D.Region { get }
/// The region containing the point where the right pupil is located.
public var rightPupil: FaceObservation.Landmarks2D.Region { 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.
public var description: String { get }
public let originatingRequestDescriptor: RequestDescriptor?
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
Truncated.
extension
FaceObservation
NewwatchOSextension FaceObservation : Codable
Declaration
extension FaceObservation : Codable {
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
extension
FaceObservation.Landmarks2D
NewwatchOSextension FaceObservation.Landmarks2D
Declaration
extension FaceObservation.Landmarks2D {
/// 2D geometry information for a specific facial feature.
public struct Region : Codable, Equatable, Sendable, Hashable, CustomStringConvertible {
/// The set of classifications that describe how to interpret the points the region provides.
public enum PointsClassification : Codable, Hashable, Sendable, Equatable {
case closedPath
case disconnected
case openPath
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: FaceObservation.Landmarks2D.Region.PointsClassification, b: FaceObservation.Landmarks2D.Region.PointsClassification) -> Bool
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Hashes the essential components of this value by feeding them into the
/// given hasher.
///
/// Implement this method to conform to the `Hashable` protocol. The
/// components used for hashing must be the same as the components compared
/// in your type's `==` operator implementation. Call `hasher.combine(_:)`
/// with each of these components.
///
/// - Important: In your implementation of `hash(into:)`,
/// don't call `finalize()` on the `hasher` instance provided,
/// or replace it with a different instance.
/// Doing so may become a compile-time error in the future.
///
/// - Parameter hasher: The hasher to use when combining the components
/// of this instance.
public func hash(into hasher: inout Hasher)
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
/// An enumeration that describes how to interpret the points the region provides.
public let pointsClassification: FaceObservation.Landmarks2D.Region.PointsClassification
/// The array of landmark points normalized to the bounding box of the `FaceObservation`.
public let points: [NormalizedPoint]
/// An array of precision estimates for each landmark point.
public let precisionEstimatesPerPoint: [Float]?
Truncated.
struct
FeaturePrintObservation
NewwatchOSpublic struct FeaturePrintObservation : VisionObservation
An observation that provides the recognized feature print.
Declaration
public struct FeaturePrintObservation : VisionObservation {
/// The feature print data.
///
/// The data is divided into separate elements. Determine the type of element using ``elementType``, and the number of elements
/// using ``elementCount``.
public let data: Data
/// The total number of elements in the data.
public let elementCount: Int
/// The type of each element in the data.
public let elementType: ElementType
/// The unique identifier for the observation.
public let uuid: UUID
/// The level of confidence normalized to `[0, 1]` where `1` is most confident.
///
/// The only exception is results coming from `CoreMLRequest`, where confidence values are forwarded as is from relevant CoreML models
public let confidence: Float
/// The time range of the reported observation.
///
/// When evaluating a sequence of image buffers, use this property to determine each observation’s start time and duration.
public let timeRange: CMTimeRange?
/// The descriptor of the request that produced the observation.
public let originatingRequestDescriptor: RequestDescriptor?
/// 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.
public var description: String { get }
/// Computes the distance between two feature print observations.
///
/// Shorter distances indicate greater similarity between feature prints.
///
/// - Parameters:
/// - featurePrint: The feature print object to calculate the distance to.
public func distance(to featurePrint: FeaturePrintObservation) throws -> Double
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: FeaturePrintObservation, b: FeaturePrintObservation) -> Bool
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
Truncated.
extension
FeaturePrintObservation
NewwatchOSextension FeaturePrintObservation : Codable
Declaration
extension FeaturePrintObservation : Codable {
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
struct
GenerateAttentionBasedSaliencyImageRequest
NewwatchOSpublic struct GenerateAttentionBasedSaliencyImageRequest : ImageProcessingRequest
An object that produces a heat map that identifies the parts of an image most likely to draw attention.
The resulting observation, SaliencyImageObservation, encodes this data as a heat map, which you can use to highlight regions of interest.
Declaration
public struct GenerateAttentionBasedSaliencyImageRequest : ImageProcessingRequest {
/// The type produced by performing a Request.
///
/// This type will either be a single VisionObservation or array of VisionObservations.
public typealias Result = SaliencyImageObservation
public enum Revision : Comparable, Sendable, Equatable, Codable, Hashable {
case revision2
/// Returns a Boolean value indicating whether the value of the first
/// argument is less than that of the second argument.
///
/// This function is the only requirement of the `Comparable` protocol. The
/// remainder of the relational operator functions are implemented by the
/// standard library for any type that conforms to `Comparable`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func < (a: GenerateAttentionBasedSaliencyImageRequest.Revision, b: GenerateAttentionBasedSaliencyImageRequest.Revision) -> Bool
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: GenerateAttentionBasedSaliencyImageRequest.Revision, b: GenerateAttentionBasedSaliencyImageRequest.Revision) -> Bool
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Hashes the essential components of this value by feeding them into the
/// given hasher.
///
/// Implement this method to conform to the `Hashable` protocol. The
/// components used for hashing must be the same as the components compared
/// in your type's `==` operator implementation. Call `hasher.combine(_:)`
/// with each of these components.
///
/// - Important: In your implementation of `hash(into:)`,
/// don't call `finalize()` on the `hasher` instance provided,
/// or replace it with a different instance.
/// Doing so may become a compile-time error in the future.
///
/// - Parameter hasher: The hasher to use when combining the components
/// of this instance.
public func hash(into hasher: inout Hasher)
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
Truncated.
struct
GenerateForegroundInstanceMaskRequest
NewwatchOSpublic struct GenerateForegroundInstanceMaskRequest : ImageProcessingRequest
A request that generates an instance mask of noticeable objects to separate from the background.
Declaration
public struct GenerateForegroundInstanceMaskRequest : ImageProcessingRequest {
/// The type produced by performing a Request.
///
/// This type will either be a single VisionObservation or array of VisionObservations.
public typealias Result = InstanceMaskObservation?
public enum Revision : Comparable, Sendable, Equatable, Codable, Hashable {
case revision1
/// Returns a Boolean value indicating whether the value of the first
/// argument is less than that of the second argument.
///
/// This function is the only requirement of the `Comparable` protocol. The
/// remainder of the relational operator functions are implemented by the
/// standard library for any type that conforms to `Comparable`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func < (a: GenerateForegroundInstanceMaskRequest.Revision, b: GenerateForegroundInstanceMaskRequest.Revision) -> Bool
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: GenerateForegroundInstanceMaskRequest.Revision, b: GenerateForegroundInstanceMaskRequest.Revision) -> Bool
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Hashes the essential components of this value by feeding them into the
/// given hasher.
///
/// Implement this method to conform to the `Hashable` protocol. The
/// components used for hashing must be the same as the components compared
/// in your type's `==` operator implementation. Call `hasher.combine(_:)`
/// with each of these components.
///
/// - Important: In your implementation of `hash(into:)`,
/// don't call `finalize()` on the `hasher` instance provided,
/// or replace it with a different instance.
/// Doing so may become a compile-time error in the future.
///
/// - Parameter hasher: The hasher to use when combining the components
/// of this instance.
public func hash(into hasher: inout Hasher)
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
Truncated.
struct
GenerateImageFeaturePrintRequest
NewwatchOSpublic struct GenerateImageFeaturePrintRequest : ImageProcessingRequest
An image-based request to generate feature prints from an image.
This request returns the feature print data it generates as an array of FeaturePrintObservation objects.
Declaration
public struct GenerateImageFeaturePrintRequest : ImageProcessingRequest {
/// The type produced by performing a Request.
///
/// This type will either be a single VisionObservation or array of VisionObservations.
public typealias Result = FeaturePrintObservation
public enum Revision : Comparable, Sendable, Equatable, Codable, Hashable {
case revision2
/// Returns a Boolean value indicating whether the value of the first
/// argument is less than that of the second argument.
///
/// This function is the only requirement of the `Comparable` protocol. The
/// remainder of the relational operator functions are implemented by the
/// standard library for any type that conforms to `Comparable`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func < (a: GenerateImageFeaturePrintRequest.Revision, b: GenerateImageFeaturePrintRequest.Revision) -> Bool
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: GenerateImageFeaturePrintRequest.Revision, b: GenerateImageFeaturePrintRequest.Revision) -> Bool
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Hashes the essential components of this value by feeding them into the
/// given hasher.
///
/// Implement this method to conform to the `Hashable` protocol. The
/// components used for hashing must be the same as the components compared
/// in your type's `==` operator implementation. Call `hasher.combine(_:)`
/// with each of these components.
///
/// - Important: In your implementation of `hash(into:)`,
/// don't call `finalize()` on the `hasher` instance provided,
/// or replace it with a different instance.
/// Doing so may become a compile-time error in the future.
///
/// - Parameter hasher: The hasher to use when combining the components
/// of this instance.
public func hash(into hasher: inout Hasher)
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
Truncated.
struct
GenerateObjectnessBasedSaliencyImageRequest
NewwatchOSpublic struct GenerateObjectnessBasedSaliencyImageRequest : ImageProcessingRequest
A request that generates a heat map that identifies the parts of an image most likely to represent objects.
The resulting observation, SaliencyImageObservation, encodes this data as a heat map, which you can use to highlight regions of interest.
Declaration
public struct GenerateObjectnessBasedSaliencyImageRequest : ImageProcessingRequest {
/// The type produced by performing a Request.
///
/// This type will either be a single VisionObservation or array of VisionObservations.
public typealias Result = SaliencyImageObservation
public enum Revision : Comparable, Sendable, Equatable, Codable, Hashable {
case revision2
/// Returns a Boolean value indicating whether the value of the first
/// argument is less than that of the second argument.
///
/// This function is the only requirement of the `Comparable` protocol. The
/// remainder of the relational operator functions are implemented by the
/// standard library for any type that conforms to `Comparable`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func < (a: GenerateObjectnessBasedSaliencyImageRequest.Revision, b: GenerateObjectnessBasedSaliencyImageRequest.Revision) -> Bool
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: GenerateObjectnessBasedSaliencyImageRequest.Revision, b: GenerateObjectnessBasedSaliencyImageRequest.Revision) -> Bool
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Hashes the essential components of this value by feeding them into the
/// given hasher.
///
/// Implement this method to conform to the `Hashable` protocol. The
/// components used for hashing must be the same as the components compared
/// in your type's `==` operator implementation. Call `hasher.combine(_:)`
/// with each of these components.
///
/// - Important: In your implementation of `hash(into:)`,
/// don't call `finalize()` on the `hasher` instance provided,
/// or replace it with a different instance.
/// Doing so may become a compile-time error in the future.
///
/// - Parameter hasher: The hasher to use when combining the components
/// of this instance.
public func hash(into hasher: inout Hasher)
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
Truncated.
struct
GeneratePersonInstanceMaskRequest
NewwatchOSpublic struct GeneratePersonInstanceMaskRequest : ImageProcessingRequest
Generates an instance mask of individual people found in the image.
Declaration
public struct GeneratePersonInstanceMaskRequest : ImageProcessingRequest {
/// The type produced by performing a Request.
///
/// This type will either be a single VisionObservation or array of VisionObservations.
public typealias Result = InstanceMaskObservation?
public enum Revision : Comparable, Sendable, Equatable, Codable, Hashable {
case revision1
/// Returns a Boolean value indicating whether the value of the first
/// argument is less than that of the second argument.
///
/// This function is the only requirement of the `Comparable` protocol. The
/// remainder of the relational operator functions are implemented by the
/// standard library for any type that conforms to `Comparable`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func < (a: GeneratePersonInstanceMaskRequest.Revision, b: GeneratePersonInstanceMaskRequest.Revision) -> Bool
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: GeneratePersonInstanceMaskRequest.Revision, b: GeneratePersonInstanceMaskRequest.Revision) -> Bool
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Hashes the essential components of this value by feeding them into the
/// given hasher.
///
/// Implement this method to conform to the `Hashable` protocol. The
/// components used for hashing must be the same as the components compared
/// in your type's `==` operator implementation. Call `hasher.combine(_:)`
/// with each of these components.
///
/// - Important: In your implementation of `hash(into:)`,
/// don't call `finalize()` on the `hasher` instance provided,
/// or replace it with a different instance.
/// Doing so may become a compile-time error in the future.
///
/// - Parameter hasher: The hasher to use when combining the components
/// of this instance.
public func hash(into hasher: inout Hasher)
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
Truncated.
struct
GenerateSelectedObjectSegmentationRequest
NewvisionOSpublic struct GenerateSelectedObjectSegmentationRequest : ImageProcessingRequest, StatefulRequest, DownloadableAssetsRequest
Generates a segmentation mask based on the provided points, rectangle, mask or scribble The request supports a maximum of 14 points or 12 points and a box
Declaration
public struct GenerateSelectedObjectSegmentationRequest : ImageProcessingRequest, StatefulRequest, DownloadableAssetsRequest {
public var assetStatus: DownloadableAssetsRequestStatus { get async }
@available(visionOS, introduced: 27.0, deprecated: 27.0, renamed: "downloadAssetsWithProgress")
public func downloadWithProgress() throws -> DownloadableAssetsProgress
public func downloadAssetsWithProgress() throws -> DownloadableAssetsProgress
/// The reciprocal of maximum rate at which buffers will be processed.
///
/// The request will not process buffers that fall within the `frameAnalysisSpacing` since the previously performed analysis.
/// The analysis is not done by wall time but by analysis of of the time stamps of the samplebuffers being processed.
public let frameAnalysisSpacing: CMTime
/// The type produced by performing a Request.
///
/// This type will either be a single VisionObservation or array of VisionObservations.
public typealias Result = PixelBufferObservation?
public enum Revision : Comparable, Sendable, Equatable, Codable, Hashable {
case revision1
/// Returns a Boolean value indicating whether the value of the first
/// argument is less than that of the second argument.
///
/// This function is the only requirement of the `Comparable` protocol. The
/// remainder of the relational operator functions are implemented by the
/// standard library for any type that conforms to `Comparable`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func < (a: GenerateSelectedObjectSegmentationRequest.Revision, b: GenerateSelectedObjectSegmentationRequest.Revision) -> Bool
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: GenerateSelectedObjectSegmentationRequest.Revision, b: GenerateSelectedObjectSegmentationRequest.Revision) -> Bool
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Hashes the essential components of this value by feeding them into the
/// given hasher.
///
/// Implement this method to conform to the `Hashable` protocol. The
/// components used for hashing must be the same as the components compared
/// in your type's `==` operator implementation. Call `hasher.combine(_:)`
/// with each of these components.
///
/// - Important: In your implementation of `hash(into:)`,
/// don't call `finalize()` on the `hasher` instance provided,
/// or replace it with a different instance.
/// Doing so may become a compile-time error in the future.
///
/// - Parameter hasher: The hasher to use when combining the components
/// of this instance.
public func hash(into hasher: inout Hasher)
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
Truncated.
struct
HorizonObservation
NewwatchOSpublic struct HorizonObservation : VisionObservation
The horizon angle information that an image analysis request detects.
Instances of this class result from invoking a DetectHorizonRequest, and report the angle and transform of the horizon in an image.
Declaration
public struct HorizonObservation : VisionObservation {
/// The transform to apply to the detected horizon.
///
/// Apply the transform's inverse to orient the image in an upright position and make the detected horizon level.
public let transform: CGAffineTransform
/// The angle of the observed horizon.
///
/// Use the angle to orient the image in an upright position and make the detected horizon level.
public let angle: Measurement<UnitAngle>
/// The unique identifier for the observation.
public let uuid: UUID
/// The level of confidence normalized to `[0, 1]` where `1` is most confident.
///
/// The only exception is results coming from `CoreMLRequest`, where confidence values are forwarded as is from relevant CoreML models
public let confidence: Float
/// The time range of the reported observation.
///
/// When evaluating a sequence of image buffers, use this property to determine each observation’s start time and duration.
public let timeRange: CMTimeRange?
/// The descriptor of the request that produced the observation.
public let originatingRequestDescriptor: RequestDescriptor?
/// 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.
public var description: String { get }
/// Creates an affine transform for the specified image width and height.
///
/// - Parameters:
/// - imageSize: The size of the image.
/// - Returns: An affine transform. Apply the transform's inverse to orient the image in an upright position and make the detected horizon level.
public func transform(for imageSize: CGSize) -> CGAffineTransform
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: HorizonObservation, b: HorizonObservation) -> Bool
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
}
extension
HorizonObservation
NewwatchOSextension HorizonObservation : Codable
Declaration
extension HorizonObservation : Codable {
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
struct
HumanObservation
NewwatchOSpublic struct HumanObservation : VisionObservation, BoundingBoxProviding
An object that represents a person that the request detects.
Declaration
public struct HumanObservation : VisionObservation, BoundingBoxProviding {
/// A Boolean value that indicates whether the observation represents an upper-body or full-body rectangle.
public let isUpperBodyOnly: Bool
/// The bounding box of the object.
///
/// The coordinate system is normalized to the dimensions of the processed image, with the origin at the lower-left corner of the image.
public let boundingBox: NormalizedRect
/// The unique identifier for the observation.
public let uuid: UUID
/// The level of confidence normalized to `[0, 1]` where `1` is most confident.
///
/// The only exception is results coming from `CoreMLRequest`, where confidence values are forwarded as is from relevant CoreML models
public let confidence: Float
/// The time range of the reported observation.
///
/// When evaluating a sequence of image buffers, use this property to determine each observation’s start time and duration.
public let timeRange: CMTimeRange?
/// The descriptor of the request that produced the observation.
public let originatingRequestDescriptor: RequestDescriptor?
/// 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.
public var description: String { get }
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: HumanObservation, b: HumanObservation) -> Bool
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
}
extension
HumanObservation
NewwatchOSextension HumanObservation : Codable
Declaration
extension HumanObservation : Codable {
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
struct
ImageAestheticsScoresObservation
NewwatchOSpublic struct ImageAestheticsScoresObservation : VisionObservation
Declaration
public struct ImageAestheticsScoresObservation : VisionObservation {
/// A Boolean value that represents images that are not necessarily of poor image quality, but may not have memorable or exciting content.
public let isUtility: Bool
/// A score which incorporates aesthetic score, failure score, and utility labels.
///
/// This returns a value within the range of `-1` and `1`, where `-1` is least desirable and `1` is most desirable.
public let overallScore: Float
/// The unique identifier for the observation.
public let uuid: UUID
/// The level of confidence normalized to `[0, 1]` where `1` is most confident.
///
/// The only exception is results coming from `CoreMLRequest`, where confidence values are forwarded as is from relevant CoreML models
public let confidence: Float
/// The time range of the reported observation.
///
/// When evaluating a sequence of image buffers, use this property to determine each observation’s start time and duration.
public let timeRange: CMTimeRange?
/// 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.
public var description: String { get }
/// The descriptor of the request that produced the observation.
public let originatingRequestDescriptor: RequestDescriptor?
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: ImageAestheticsScoresObservation, b: ImageAestheticsScoresObservation) -> Bool
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
}
extension
ImageAestheticsScoresObservation
NewwatchOSextension ImageAestheticsScoresObservation : Codable
Declaration
extension ImageAestheticsScoresObservation : Codable {
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
enum
ImageCropAndScaleAction
NewwatchOSpublic enum ImageCropAndScaleAction : CaseIterable, Codable, Equatable, Hashable, Sendable
Declaration
public enum ImageCropAndScaleAction : CaseIterable, Codable, Equatable, Hashable, Sendable {
/// Scale image maintaining aspect ratio to fit on the short side and crop centered on the long side.
case centerCrop
/// Scale to size required by algorithm while maintaining the original aspect ratio.
case scaleToFit
/// An option that scales the image to fill the input dimensions, resizing it if necessary.
case scaleToFill
/// Scale image maintaining aspect ratio to fit on the long side but also rotate by 90 degrees counter clockwise to optimize portrait images to fit into landscape buffers for algorithms that are rotation agnostic.
case scaleToFitPlus90CCWRotation
/// Scale image and rotate by 90 degrees counter clockwise to optimize portrait images to fill into landscape buffers for algorithms that are rotation agnostic.
case scaleToFillPlus90CCWRotation
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: ImageCropAndScaleAction, b: ImageCropAndScaleAction) -> Bool
/// A type that can represent a collection of all values of this type.
@available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 27.0, visionOS 2.0, *)
public typealias AllCases = [ImageCropAndScaleAction]
/// A collection of all values of this type.
nonisolated public static var allCases: [ImageCropAndScaleAction] { get }
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Hashes the essential components of this value by feeding them into the
/// given hasher.
///
/// Implement this method to conform to the `Hashable` protocol. The
/// components used for hashing must be the same as the components compared
/// in your type's `==` operator implementation. Call `hasher.combine(_:)`
/// with each of these components.
///
/// - Important: In your implementation of `hash(into:)`,
/// don't call `finalize()` on the `hasher` instance provided,
/// or replace it with a different instance.
/// Doing so may become a compile-time error in the future.
///
/// - Parameter hasher: The hasher to use when combining the components
/// of this instance.
public func hash(into hasher: inout Hasher)
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
struct
ImageHomographicAlignmentObservation
NewwatchOSpublic struct ImageHomographicAlignmentObservation : VisionObservation
An object that represents a perspective warp transformation.
This type of observation results from a TrackHomographicImageRegistrationRequest, informing the warpTransform performed to align the input images.
Declaration
public struct ImageHomographicAlignmentObservation : VisionObservation {
/// The warp transform matrix to morph the floating image into the reference image.
public let warpTransform: matrix_float3x3
/// The unique identifier for the observation.
public let uuid: UUID
/// The level of confidence normalized to `[0, 1]` where `1` is most confident.
///
/// The only exception is results coming from `CoreMLRequest`, where confidence values are forwarded as is from relevant CoreML models
public let confidence: Float
/// The time range of the reported observation.
///
/// When evaluating a sequence of image buffers, use this property to determine each observation’s start time and duration.
public let timeRange: CMTimeRange?
/// The descriptor of the request that produced the observation.
public let originatingRequestDescriptor: RequestDescriptor?
/// 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.
public var description: String { get }
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: ImageHomographicAlignmentObservation, b: ImageHomographicAlignmentObservation) -> Bool
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
}
extension
ImageHomographicAlignmentObservation
NewwatchOSextension ImageHomographicAlignmentObservation : Codable
Declaration
extension ImageHomographicAlignmentObservation : Codable {
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
protocol
ImageProcessingRequest
NewwatchOSpublic protocol ImageProcessingRequest : VisionRequest
An image analysis request that operates on a region of interest and produces observations.
Declaration
public protocol ImageProcessingRequest : VisionRequest {
/// The region of the image in which Vision will perform the request.
///
/// The rectangle is normalized to the dimensions of the processed image. Its origin is specified relative to the image's lower-left corner.
/// By default, the region of interest will be the full image.
var regionOfInterest: NormalizedRect { get set }
/// Perform the request on a `CVPixelBuffer` and produce observations.
///
/// - Parameters:
/// - pixelBuffer: The input `CVPixelBuffer` on which to perform the request.
/// - orientation: The orientation of the input image. Default is `nil`.
///
/// - Returns: The observation(s) produced by the request.
func perform(on pixelBuffer: CVPixelBuffer, orientation: CGImagePropertyOrientation?) async throws -> Self.Result
/// Perform the request on an image `URL` and produce observations.
///
/// - Parameters:
/// - url: The input `URL` on which to perform the request.
/// - orientation: The orientation of the input image. Default is `nil`.
///
/// - Returns: The observation(s) produced by the request.
func perform(on url: URL, orientation: CGImagePropertyOrientation?) async throws -> Self.Result
/// Perform the request on a `CGImage` and produce observations.
///
/// - Parameters:
/// - image: The input `CGImage` on which to perform the request.
/// - orientation: The orientation of the input image. Default is `nil`.
///
/// - Returns: The observation(s) produced by the request.
func perform(on image: CGImage, orientation: CGImagePropertyOrientation?) async throws -> Self.Result
/// Perform the request on a `CMSampleBuffer` and produce observations.
///
/// - Parameters:
/// - sampleBuffer: The input `CMSampleBuffer` on which to perform the request.
/// - orientation: The orientation of the input image. Default is `nil`.
///
/// - Returns: The observation(s) produced by the request.
func perform(on sampleBuffer: CMSampleBuffer, orientation: CGImagePropertyOrientation?) async throws -> Self.Result
/// Perform the request on image `Data` and produce observations.
///
/// - Parameters:
/// - data: The input `Data` on which to perform the request.
/// - orientation: The orientation of the input image. Default is `nil`.
///
/// - Returns: The observation(s) produced by the request.
func perform(on data: Data, orientation: CGImagePropertyOrientation?) async throws -> Self.Result
}
extension
ImageProcessingRequest
NewwatchOSextension ImageProcessingRequest
Declaration
extension ImageProcessingRequest {
/// Perform the request on a `CVPixelBuffer` and produce observations.
///
/// - Parameters:
/// - pixelBuffer: The input `CVPixelBuffer` on which to perform the request.
/// - orientation: The orientation of the input image. Default is `nil`.
///
/// - Returns: The observation(s) produced by the request.
public func perform(on pixelBuffer: CVPixelBuffer, orientation: CGImagePropertyOrientation? = nil) async throws -> Self.Result
/// Perform the request on an image `URL` and produce observations.
///
/// - Parameters:
/// - url: The input `URL` on which to perform the request.
/// - orientation: The orientation of the input image. Default is `nil`.
///
/// - Returns: The observation(s) produced by the request.
public func perform(on url: URL, orientation: CGImagePropertyOrientation? = nil) async throws -> Self.Result
/// Perform the request on a `CGImage` and produce observations.
///
/// - Parameters:
/// - image: The input `CGImage` on which to perform the request.
/// - orientation: The orientation of the input image. Default is `nil`.
///
/// - Returns: The observation(s) produced by the request.
public func perform(on image: CGImage, orientation: CGImagePropertyOrientation? = nil) async throws -> Self.Result
/// Perform the request on a `CMSampleBuffer` and produce observations.
///
/// - Parameters:
/// - sampleBuffer: The input `CMSampleBuffer` on which to perform the request.
/// - orientation: The orientation of the input image. Default is `nil`.
///
/// - Returns: The observation(s) produced by the request.
public func perform(on sampleBuffer: CMSampleBuffer, orientation: CGImagePropertyOrientation? = nil) async throws -> Self.Result
/// Perform the request on image `Data` and produce observations.
///
/// - Parameters:
/// - data: The input `Data` on which to perform the request.
/// - orientation: The orientation of the input image. Default is `nil`.
///
/// - Returns: The observation(s) produced by the request.
public func perform(on data: Data, orientation: CGImagePropertyOrientation? = nil) async throws -> Self.Result
}
struct
ImageTranslationAlignmentObservation
NewwatchOSpublic struct ImageTranslationAlignmentObservation : VisionObservation
Affine transform information that an image alignment request produces.
This type of observation results from a TrackTranslationalImageRegistrationRequest, informing the alignmentTransform performed to align the input images.
Declaration
public struct ImageTranslationAlignmentObservation : VisionObservation {
/// The alignment transform to align the floating image with the reference image.
public let alignmentTransform: CGAffineTransform
/// The unique identifier for the observation.
public let uuid: UUID
/// The level of confidence normalized to `[0, 1]` where `1` is most confident.
///
/// The only exception is results coming from `CoreMLRequest`, where confidence values are forwarded as is from relevant CoreML models
public let confidence: Float
/// The time range of the reported observation.
///
/// When evaluating a sequence of image buffers, use this property to determine each observation’s start time and duration.
public let timeRange: CMTimeRange?
/// The descriptor of the request that produced the observation.
public let originatingRequestDescriptor: RequestDescriptor?
/// 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.
public var description: String { get }
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: ImageTranslationAlignmentObservation, b: ImageTranslationAlignmentObservation) -> Bool
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
}
extension
ImageTranslationAlignmentObservation
NewwatchOSextension ImageTranslationAlignmentObservation : Codable
Declaration
extension ImageTranslationAlignmentObservation : Codable {
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
func
includePoint
NewvisionOSfinal public func includePoint(_ point: NormalizedPoint)
struct
InstanceMaskObservation
NewwatchOSpublic struct InstanceMaskObservation : VisionObservation, @unchecked Sendable
An observation that contains an instance mask that labels instances in the mask.
Declaration
public struct InstanceMaskObservation : VisionObservation, @unchecked Sendable {
/// The collection that contains all instances, excluding the background.
public let allInstances: IndexSet
/// The resulting mask that represents all instances.
///
/// A pixel can only correspond to one instance. A 0 represents the background, and all other values represent the indices of the instances.
public let allInstancesMask: PixelBufferObservation
/// The unique identifier for the observation.
public let uuid: UUID
/// The level of confidence normalized to `[0, 1]` where `1` is most confident.
///
/// The only exception is results coming from `CoreMLRequest`, where confidence values are forwarded as is from relevant CoreML models
public let confidence: Float
/// The time range of the reported observation.
///
/// When evaluating a sequence of image buffers, use this property to determine each observation’s start time and duration.
public let timeRange: CMTimeRange?
/// 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.
public var description: String { get }
/// Creates a low-resolution mask from the instances you specify.
///
/// - Parameters:
/// - instances: An IndexSet of selected instances, where 0 is the background.
///
/// - Returns: The pixel buffer that contains the mask.
public func generateMask(for instances: IndexSet) throws -> CVPixelBuffer
/// Creates a high-resolution image with everything except for the instances you specify masked out.
///
/// The image produced has the same resolution as the image in the `requestHandler`.
///
/// - Parameters:
/// - instances: An IndexSet of selected instances, where 0 is the background.
/// - requestHandler: A request handler containing an image to be masked.
/// - croppedToInstancesExtent: Crops the image to the smallest rectangle contaning all instances
/// - Returns: The pixel buffer that contains the image.
public func generateMaskedImage(for instances: IndexSet, imageFrom requestHandler: ImageRequestHandler, croppedToInstancesExtent: Bool = false) throws -> CVPixelBuffer
/// Creates a high-resolution mask representing a combination of the instances you specify.
///
/// The image produced has the same resolution as the image in the `requestHandler`.
///
/// - Parameters:
/// - instances: An IndexSet of selected instances, where 0 is the background.
/// - requestHandler: A request handler containing an image.
///
/// - Returns: The pixel buffer that contains the mask.
public func generateScaledMask(for instances: IndexSet, scaledToImageFrom requestHandler: ImageRequestHandler) throws -> CVPixelBuffer
/// Creates an index set containing the instance found at the specified point.
public func instanceAtPoint(_ point: NormalizedPoint) -> IndexSet
Truncated.
extension
InstanceMaskObservation
NewwatchOSextension InstanceMaskObservation : Codable
Declaration
extension InstanceMaskObservation : Codable {
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
struct
Joint
NewwatchOSpublic struct Joint : Codable, Equatable, Hashable, Sendable, CustomStringConvertible
A body pose joint represented as a normalized point in an image, along with a joint name label and a confidence value.
Declaration
public struct Joint : Codable, Equatable, Hashable, Sendable, CustomStringConvertible {
/// The location of the joint in normalized coordinates.
public let location: NormalizedPoint
/// The joint's identifier label.
public let jointName: String
/// A confidence score that indicates the detected joint’s accuracy.
public let confidence: Float
public func distance(to joint: Joint) -> CGFloat
/// 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.
public var description: String { get }
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: Joint, b: Joint) -> Bool
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Hashes the essential components of this value by feeding them into the
/// given hasher.
///
/// Implement this method to conform to the `Hashable` protocol. The
/// components used for hashing must be the same as the components compared
/// in your type's `==` operator implementation. Call `hasher.combine(_:)`
/// with each of these components.
///
/// - Important: In your implementation of `hash(into:)`,
/// don't call `finalize()` on the `hasher` instance provided,
/// or replace it with a different instance.
/// Doing so may become a compile-time error in the future.
///
/// - Parameter hasher: The hasher to use when combining the components
/// of this instance.
public func hash(into hasher: inout Hasher)
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
Truncated.
struct
NormalizedCircle
NewwatchOSpublic struct NormalizedCircle
Declaration
public struct NormalizedCircle {
public init(center: NormalizedPoint, radius: CGFloat)
public let center: NormalizedPoint
public let radius: CGFloat
/// Determines if this circle, including its boundary, contains the specified point.
public func contains(_ point: NormalizedPoint) -> Bool
/// Determines if a ring around this circle’s circumference contains the specified point.
public func contains(_ point: NormalizedPoint, inCircumferentialRingOfWidth ringWidth: CGFloat) -> Bool
public static var zero: NormalizedCircle { get }
public static func boundingCircle(for points: [NormalizedPoint]) -> NormalizedCircle
}
struct
NormalizedPoint
NewwatchOSpublic struct NormalizedPoint : Hashable, Equatable, Codable, Sendable, CustomStringConvertible
A 2D point with x and y coordinates in the range [0, 1].
Declaration
public struct NormalizedPoint : Hashable, Equatable, Codable, Sendable, CustomStringConvertible {
/// Creates a point object with the specified coordinates.
///
/// - Parameters:
/// - x: The x-coordinate value.
/// - y: The y-coordinate value.
public init(x: CGFloat, y: CGFloat)
/// Creates a point object from the specified Core Graphics point.
public init(normalizedPoint: CGPoint)
/// Creates a normalized point from a point in an image coordinate space.
///
/// - Parameters:
/// - imagePoint: A point in the image coordinate space.
/// - imageSize: The size of the image.
public init(imagePoint: CGPoint, in imageSize: CGSize)
/// Creates a point normalized to a region of interest within an image.
///
/// - Parameters:
/// - imagePoint: A point in the image coordinate space.
/// - imageSize: The size of the image.
/// - regionOfInterest: The region within the image that the point will be normalized to
public init(imagePoint: CGPoint, in imageSize: CGSize, normalizedTo regionOfInterest: NormalizedRect)
/// A point object that represents the origin, [0,0].
public static var zero: NormalizedPoint { get }
/// The Core Graphics point for this point.
public let cgPoint: CGPoint
/// The x-coordinate.
public var x: CGFloat { get }
/// The y-coordinate.
public var y: CGFloat { get }
/// Converts a point normalized to a region within an image into full image coordinates.
///
/// - Parameters:
/// - imageSize: The size of the image.
/// - regionOfInterest: The region within an image the `NormalizedPoint` is normalized to.
public func toImageCoordinates(from regionOfInterest: NormalizedRect, imageSize: CGSize, origin: CoordinateOrigin = .lowerLeft) -> CGPoint
/// Converts a point in normalized coordinates into image coordinates.
///
/// - Parameters:
/// - imageSize: The size of the image.
public func toImageCoordinates(_ imageSize: CGSize, origin: CoordinateOrigin = .lowerLeft) -> CGPoint
/// Returns a `NormalizedPoint` with the origin flipped between the top and bottom of the image.
public func verticallyFlipped() -> NormalizedPoint
/// Hashes the essential components of this value by feeding them into the
/// given hasher.
///
/// Implement this method to conform to the `Hashable` protocol. The
/// components used for hashing must be the same as the components compared
/// in your type's `==` operator implementation. Call `hasher.combine(_:)`
/// with each of these components.
///
/// - Important: In your implementation of `hash(into:)`,
/// don't call `finalize()` on the `hasher` instance provided,
/// or replace it with a different instance.
/// Doing so may become a compile-time error in the future.
///
/// - Parameter hasher: The hasher to use when combining the components
/// of this instance.
public func hash(into hasher: inout Hasher)
/// 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`:
///
Truncated.
struct
NormalizedRect
NewwatchOSpublic struct NormalizedRect : Equatable, Hashable, Codable, Sendable, CustomStringConvertible
A rectangle with normalized coordinates in the range [0, 1].
Declaration
public struct NormalizedRect : Equatable, Hashable, Codable, Sendable, CustomStringConvertible {
/// Creates a rectangle with the specified coordinates.
///
/// - Parameters:
/// - x: The x-coordinate of the rectangle's lower-left corner.
/// - y: The y-coordinate of the rectangle's lower-left corner..
/// - width: The width of the rectangle
/// - height: The height of the rectangle
public init(x: CGFloat, y: CGFloat, width: CGFloat, height: CGFloat)
/// Creates a normalized rectangle from a rectangle in an image coordinate space.
///
/// - Parameters:
/// - imageRect: A rectangle in the image coordinate space.
/// - imageSize: The size of the image.
public init(imageRect: CGRect, in imageSize: CGSize)
/// Creates a rectangle normalized to a region of interest in an image from a rectangle in an image coordinate space.
///
/// - Parameters:
/// - imageRect: A rectangle in the image coordinate space.
/// - imageSize: The size of the image.
public init(imageRect: CGRect, in imageSize: CGSize, normalizedTo regionOfInterest: NormalizedRect)
/// Creates a rectangle from the specified Core Graphics rectangle.
public init(normalizedRect: CGRect)
/// A normalized rectangle with origin at [0,0] and a width and height of 1.0.
public static var fullImage: NormalizedRect { get }
/// The normalized rectangle as a CGRect.
public let cgRect: CGRect
/// The lower-left hand corner of the rectangle.
public var origin: CGPoint { get }
/// The width of the rectangle
public var width: CGFloat { get }
/// The height of the rectangle
public var height: CGFloat { get }
/// Converts a rectangle in normalized coordinates into image coordinates.
///
/// - Parameters:
/// - imageSize: The size of the image.
public func toImageCoordinates(_ imageSize: CGSize, origin: CoordinateOrigin = .lowerLeft) -> CGRect
/// Converts a rectangle normalized to a region within an image into full image coordinates.
///
/// - Parameters:
/// - imageSize: The size of the image.
/// - regionOfInterest: The region within an image the `NormalizedPoint` is normalized to.
public func toImageCoordinates(from regionOfInterest: NormalizedRect, imageSize: CGSize, origin: CoordinateOrigin = .lowerLeft) -> CGRect
/// Returns a `NormalizedRect` with the origin flipped between the top and bottom of the image.
public func verticallyFlipped() -> NormalizedRect
/// Hashes the essential components of this value by feeding them into the
/// given hasher.
///
/// Implement this method to conform to the `Hashable` protocol. The
/// components used for hashing must be the same as the components compared
/// in your type's `==` operator implementation. Call `hasher.combine(_:)`
/// with each of these components.
///
/// - Important: In your implementation of `hash(into:)`,
/// don't call `finalize()` on the `hasher` instance provided,
/// or replace it with a different instance.
/// Doing so may become a compile-time error in the future.
///
/// - Parameter hasher: The hasher to use when combining the components
/// of this instance.
public func hash(into hasher: inout Hasher)
/// 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:)`
Truncated.
typealias
NormalizedRegion
NewwatchOSpublic typealias NormalizedRegion = ContoursObservation.Contour
struct
OCRTool
NewiOSmacOSpublic struct OCRTool : Tool, @unchecked Sendable
A tool that recognizes text in an image.
The tool returns a string containing all recognized text from the image. To enable this tool, configure your LanguageModelSession with an instance of OCRTool.
let ocrTool = OCRTool()
let session = LanguageModelSession(tools: [ocrTool])
You can override the default name and description to customize how the model identifies and uses the tool.
let customTool = OCRTool(
name: "extractText",
description: "Extract text from documents"
)
Declaration
public struct OCRTool : Tool, @unchecked Sendable {
/// A unique name for the tool, such as "get_weather", "toggleDarkMode", or "search contacts".
public let name: String
/// A natural language description of when and how to use the tool.
public let description: String
/// Creates a tool for recognizing text in images.
///
/// - Parameters:
/// - name: The name of the tool as exposed to the model. If not provided, a default name is used.
/// - description: A description of what the tool does, used by the model to determine when to call it. If not provided, a default description is used.
public init(name: String? = nil, description: String? = nil)
/// The arguments that this tool should accept.
///
/// Typically arguments are either a ``Generable`` type or ``GeneratedContent``.
public struct Arguments {
/// An instance of the generation schema.
nonisolated public static var generationSchema: GenerationSchema { get }
/// This instance represented as generated content.
///
/// Conformance to this protocol is provided by the `@Generable` macro.
/// A manual implementation may be used to map values onto properties using
/// different names. Use the generated content property as shown below, to
/// manually return a new ``GeneratedContent`` with the properties you specify.
///
/// ```swift
/// struct Person: ConvertibleToGeneratedContent {
/// var name: String
/// var age: Int
///
/// var generatedContent: GeneratedContent {
/// GeneratedContent(properties: [
/// "firstName": name,
/// "ageInYears": age
/// ])
/// }
/// }
/// ```
///
/// - Important: If your type also conforms to ``ConvertibleFromGeneratedContent``,
/// it is critical that this implementation be symmetrical with ``ConvertibleFromGeneratedContent/init(_:)``.
nonisolated public var generatedContent: GeneratedContent { get }
/// A representation of partially generated content
nonisolated public struct PartiallyGenerated : Identifiable, nonisolated ConvertibleFromGeneratedContent {
/// The stable identity of the entity associated with this instance.
public var id: GenerationID
/// Creates an instance from content generated by a model.
///
/// Conformance to this protocol is provided by the `@Generable` macro.
/// A manual implementation may be used to map values onto properties using
/// different names. To manually initialize your type from generated content,
/// decode the values as shown below:
///
/// ```swift
/// struct Person: ConvertibleFromGeneratedContent {
/// var name: String
/// var age: Int
///
/// init(_ content: GeneratedContent) {
/// self.name = try content.value(forProperty: "firstName")
/// self.age = try content.value(forProperty: "ageInYears")
/// }
/// }
/// ```
///
/// - Important: If your type also conforms to ``ConvertibleToGeneratedContent``,
/// it is critical that this implementation be symmetrical with ``ConvertibleToGeneratedContent/generatedContent``.
///
/// - SeeAlso: `@Generable` macro ``Generable(description:)``
nonisolated public init(_ content: GeneratedContent) throws
/// A type representing the stable identity of the entity associated with
Truncated.
extension
OCRTool.Arguments
NewiOSmacOSextension OCRTool.Arguments : nonisolated Generable
Declaration
extension OCRTool.Arguments : nonisolated Generable {
/// Creates an instance from content generated by a model.
///
/// Conformance to this protocol is provided by the `@Generable` macro.
/// A manual implementation may be used to map values onto properties using
/// different names. To manually initialize your type from generated content,
/// decode the values as shown below:
///
/// ```swift
/// struct Person: ConvertibleFromGeneratedContent {
/// var name: String
/// var age: Int
///
/// init(_ content: GeneratedContent) {
/// self.name = try content.value(forProperty: "firstName")
/// self.age = try content.value(forProperty: "ageInYears")
/// }
/// }
/// ```
///
/// - Important: If your type also conforms to ``ConvertibleToGeneratedContent``,
/// it is critical that this implementation be symmetrical with ``ConvertibleToGeneratedContent/generatedContent``.
///
/// - SeeAlso: `@Generable` macro ``Generable(description:)``
nonisolated public init(_ content: GeneratedContent) throws
}
struct
OpticalFlowObservation
NewwatchOSpublic struct OpticalFlowObservation : VisionObservation, @unchecked Sendable
An object that represents an optical flow that an image analysis request produces.
The optical flow is a 2d image, with each pixel representing the directional change from a previous to current image.
Declaration
public struct OpticalFlowObservation : VisionObservation, @unchecked Sendable {
/// The size of the observation image.
public var size: CGSize { get }
/// The four-character code OSType identifier for the pixel format.
public var pixelFormat: OSType { get }
@available(macOS 27.0, iOS 27.0, tvOS 27.0, watchOS 27.0, *)
public var pixelBuffer: CVReadOnlyPixelBuffer { get }
/// The unique identifier for the observation.
public let uuid: UUID
/// The level of confidence normalized to `[0, 1]` where `1` is most confident.
///
/// The only exception is results coming from `CoreMLRequest`, where confidence values are forwarded as is from relevant CoreML models
public let confidence: Float
/// The time range of the reported observation.
///
/// When evaluating a sequence of image buffers, use this property to determine each observation’s start time and duration.
public let timeRange: CMTimeRange?
/// The descriptor of the request that produced the observation.
public let originatingRequestDescriptor: RequestDescriptor?
/// 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.
public var description: String { get }
@available(*, deprecated, renamed: "pixelBuffer.withUnsafeBuffer")
public func withUnsafePointer<R>(_ body: (UnsafeRawPointer) -> R) -> R
/// Returns the optical flow for the specified location in the observation image
public func flow(at point: NormalizedPoint) -> (Float, Float)
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (lhs: OpticalFlowObservation, rhs: OpticalFlowObservation) -> Bool
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
}
struct
PixelBufferObservation
NewwatchOSpublic struct PixelBufferObservation : VisionObservation, @unchecked Sendable
An object that represents an image that an image analysis request produces.
Declaration
public struct PixelBufferObservation : VisionObservation, @unchecked Sendable {
/// The size of the observation image.
public var size: CGSize { get }
/// The four-character code OSType identifier for the pixel format.
public var pixelFormat: OSType { get }
@available(macOS 27.0, iOS 27.0, tvOS 27.0, watchOS 27.0, *)
public var pixelBuffer: CVReadOnlyPixelBuffer { get }
/// A Core Graphics image created from the pixel buffer observation.
public var cgImage: CGImage { get throws }
/// The unique identifier for the observation.
public let uuid: UUID
/// The level of confidence normalized to `[0, 1]` where `1` is most confident.
///
/// The only exception is results coming from `CoreMLRequest`, where confidence values are forwarded as is from relevant CoreML models
public let confidence: Float
/// The time range of the reported observation.
///
/// When evaluating a sequence of image buffers, use this property to determine each observation’s start time and duration.
public let timeRange: CMTimeRange?
/// The descriptor of the request that produced the observation.
public let originatingRequestDescriptor: RequestDescriptor?
/// 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.
public var description: String { get }
@available(*, deprecated, renamed: "pixelBuffer.withUnsafeBuffer")
public func withUnsafePointer<R>(_ body: (UnsafeRawPointer) -> R) -> R
/// Returns the pixel data for the specified location in the image
public func pixel(at point: NormalizedPoint) -> Float
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (lhs: PixelBufferObservation, rhs: PixelBufferObservation) -> Bool
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
Truncated.
protocol
PoseProviding
NewwatchOSpublic protocol PoseProviding
An observation that provides a collection of joints that make up a pose.
Declaration
public protocol PoseProviding {
associatedtype PoseJointName : Decodable, Encodable, Hashable, RawRepresentable where Self.PoseJointName.RawValue == String
associatedtype PoseJointsGroupName : CaseIterable, RawRepresentable where Self.PoseJointsGroupName.RawValue == String
/// The names of the available joints in the observation.
var availableJointNames: [Self.PoseJointName] { get }
/// The names of the available joint groupings in the observation.
var availableJointsGroupNames: [Self.PoseJointsGroupName] { get }
/// Retrieves a joint for a given joint name.
func joint(for jointName: Self.PoseJointName) -> Joint?
/// Retrieves a dictionary of joints for a joint group.
func allJoints(in groupName: Self.PoseJointsGroupName?) -> [Self.PoseJointName : Joint]
}
protocol
QuadrilateralProviding
NewwatchOSpublic protocol QuadrilateralProviding : BoundingBoxProviding
An protocol for objects that have a bounding quadrilateral.
The quadrilateral's coordinate system is normalized to the dimensions of the processed image, with the origin at the lower-left corner of the image.
Declaration
public protocol QuadrilateralProviding : BoundingBoxProviding {
/// The coordinates of the upper-left corner of the quadrilateral.
var topLeft: NormalizedPoint { get }
/// The coordinates of the upper-right corner of the quadrilateral.
var topRight: NormalizedPoint { get }
/// The coordinates of the lower-right corner of the quadrilateral.
var bottomRight: NormalizedPoint { get }
/// The coordinates of the lower-left corner of the quadrilateral.
var bottomLeft: NormalizedPoint { get }
}
extension
QuadrilateralProviding
NewwatchOSextension QuadrilateralProviding
Declaration
extension QuadrilateralProviding {
/// The bounding box of the object.
///
/// The coordinate system is normalized to the dimensions of the processed image, with the origin at the lower-left corner of the image.
public var boundingBox: NormalizedRect { get }
}
struct
RecognizeAnimalsRequest
NewwatchOSpublic struct RecognizeAnimalsRequest : ImageProcessingRequest
A request that will recognize various animals in an image.
Declaration
public struct RecognizeAnimalsRequest : ImageProcessingRequest {
/// The type produced by performing a Request.
///
/// This type will either be a single VisionObservation or array of VisionObservations.
public typealias Result = [RecognizedObjectObservation]
public enum Revision : Comparable, Sendable, Equatable, Codable, Hashable {
case revision2
/// Returns a Boolean value indicating whether the value of the first
/// argument is less than that of the second argument.
///
/// This function is the only requirement of the `Comparable` protocol. The
/// remainder of the relational operator functions are implemented by the
/// standard library for any type that conforms to `Comparable`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func < (a: RecognizeAnimalsRequest.Revision, b: RecognizeAnimalsRequest.Revision) -> Bool
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: RecognizeAnimalsRequest.Revision, b: RecognizeAnimalsRequest.Revision) -> Bool
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Hashes the essential components of this value by feeding them into the
/// given hasher.
///
/// Implement this method to conform to the `Hashable` protocol. The
/// components used for hashing must be the same as the components compared
/// in your type's `==` operator implementation. Call `hasher.combine(_:)`
/// with each of these components.
///
/// - Important: In your implementation of `hash(into:)`,
/// don't call `finalize()` on the `hasher` instance provided,
/// or replace it with a different instance.
/// Doing so may become a compile-time error in the future.
///
/// - Parameter hasher: The hasher to use when combining the components
/// of this instance.
public func hash(into hasher: inout Hasher)
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
Truncated.
extension
RecognizeAnimalsRequest.Animal
NewwatchOSextension RecognizeAnimalsRequest.Animal : RawRepresentable
Declaration
extension RecognizeAnimalsRequest.Animal : RawRepresentable {
}
struct
RecognizedObjectObservation
NewwatchOSpublic struct RecognizedObjectObservation : VisionObservation, BoundingBoxProviding
An observation with an array of classification labels that classify the recognized object.
The confidence of the classifications sum up to 1.0. Multiply the classification confidence with the confidence of this observation.
Declaration
public struct RecognizedObjectObservation : VisionObservation, BoundingBoxProviding {
/// The classification(s) of the recognized object.
public let labels: [ClassificationObservation]
/// The bounding box of the object.
///
/// The coordinate system is normalized to the dimensions of the processed image, with the origin at the lower-left corner of the image.
public let boundingBox: NormalizedRect
/// The unique identifier for the observation.
public let uuid: UUID
/// The level of confidence normalized to `[0, 1]` where `1` is most confident.
///
/// The only exception is results coming from `CoreMLRequest`, where confidence values are forwarded as is from relevant CoreML models
public let confidence: Float
/// The time range of the reported observation.
///
/// When evaluating a sequence of image buffers, use this property to determine each observation’s start time and duration.
public let timeRange: CMTimeRange?
/// The descriptor of the request that produced the observation.
public let originatingRequestDescriptor: RequestDescriptor?
/// 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.
public var description: String { get }
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: RecognizedObjectObservation, b: RecognizedObjectObservation) -> Bool
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
}
extension
RecognizedObjectObservation
NewwatchOSextension RecognizedObjectObservation : Codable
Declaration
extension RecognizedObjectObservation : Codable {
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
struct
RectangleObservation
NewwatchOSpublic struct RectangleObservation : VisionObservation, QuadrilateralProviding
An object that represents the four vertices of a detected rectangle.
Declaration
public struct RectangleObservation : VisionObservation, QuadrilateralProviding {
public init(topLeft: NormalizedPoint, topRight: NormalizedPoint, bottomRight: NormalizedPoint, bottomLeft: NormalizedPoint)
/// The coordinates of the upper-left corner of the quadrilateral.
public let topLeft: NormalizedPoint
/// The coordinates of the upper-right corner of the quadrilateral.
public let topRight: NormalizedPoint
/// The coordinates of the lower-right corner of the quadrilateral.
public let bottomRight: NormalizedPoint
/// The coordinates of the lower-left corner of the quadrilateral.
public let bottomLeft: NormalizedPoint
/// The unique identifier for the observation.
public let uuid: UUID
/// The level of confidence normalized to `[0, 1]` where `1` is most confident.
///
/// The only exception is results coming from `CoreMLRequest`, where confidence values are forwarded as is from relevant CoreML models
public let confidence: Float
/// The time range of the reported observation.
///
/// When evaluating a sequence of image buffers, use this property to determine each observation’s start time and duration.
public let timeRange: CMTimeRange?
/// The descriptor of the request that produced the observation.
public let originatingRequestDescriptor: RequestDescriptor?
/// 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.
public var description: String { get }
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: RectangleObservation, b: RectangleObservation) -> Bool
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
}
extension
RectangleObservation
NewwatchOSextension RectangleObservation : Codable
Declaration
extension RectangleObservation : Codable {
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
enum
RequestDescriptor
NewwatchOSpublic enum RequestDescriptor : CustomStringConvertible, Equatable, Sendable, Codable, Hashable
Declaration
public enum RequestDescriptor : CustomStringConvertible, Equatable, Sendable, Codable, Hashable {
case detectFaceRectanglesRequest(DetectFaceRectanglesRequest.Revision)
case detectHumanRectanglesRequest(DetectHumanRectanglesRequest.Revision)
case classifyImageRequest(ClassifyImageRequest.Revision)
case calculateImageAestheticsScoresRequest(CalculateImageAestheticsScoresRequest.Revision)
case coreMLRequest(CoreMLRequest.Revision)
case detectBarcodesRequest(DetectBarcodesRequest.Revision)
case detectContoursRequest(DetectContoursRequest.Revision)
case detectDocumentSegmentationRequest(DetectDocumentSegmentationRequest.Revision)
case detectFaceCaptureQualityRequest(DetectFaceCaptureQualityRequest.Revision)
case detectFaceLandmarksRequest(DetectFaceLandmarksRequest.Revision)
case detectHorizonRequest(DetectHorizonRequest.Revision)
case detectRectanglesRequest(DetectRectanglesRequest.Revision)
case detectTrajectoriesRequest(DetectTrajectoriesRequest.Revision)
@available(macOS 26.0, iOS 26.0, tvOS 26.0, watchOS 27.0, *)
case detectLensSmudgeRequest(DetectLensSmudgeRequest.Revision)
case generateAttentionBasedSaliencyImageRequest(GenerateAttentionBasedSaliencyImageRequest.Revision)
case generateImageFeaturePrintRequest(GenerateImageFeaturePrintRequest.Revision)
case generateForegroundInstanceMaskRequest(GenerateForegroundInstanceMaskRequest.Revision)
case generateObjectnessBasedSaliencyImageRequest(GenerateObjectnessBasedSaliencyImageRequest.Revision)
case generatePersonSegmentationRequest(GeneratePersonSegmentationRequest.Revision)
case generatePersonInstanceMaskRequest(GeneratePersonInstanceMaskRequest.Revision)
case recognizeAnimalsRequest(RecognizeAnimalsRequest.Revision)
case trackHomographicImageRegistrationRequest(TrackHomographicImageRegistrationRequest.Revision)
case trackObjectRequest(TrackObjectRequest.Revision)
case trackRectangleRequest(TrackRectangleRequest.Revision)
case trackTranslationalImageRegistrationRequest(TrackTranslationalImageRegistrationRequest.Revision)
/// 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.
public var description: String { get }
/// Returns a Boolean value indicating whether two values are equal.
///
Truncated.
struct
SaliencyImageObservation
NewwatchOSpublic struct SaliencyImageObservation : VisionObservation
An observation that contains a grayscale heat map of important areas across an image.
Declaration
public struct SaliencyImageObservation : VisionObservation {
/// A collection of objects describing the distinct areas of the saliency heat map.
///
/// The objects in this array don't follow any specific ordering.
/// It's up to your app to iterate across the observations and apply desired ordering.
public let salientObjects: [RectangleObservation]
/// A grayscale heat map of important areas across the image.
///
/// The heat map is a pixel buffer in a one-component floating-point pixel format.
public let heatMap: PixelBufferObservation
/// The unique identifier for the observation.
public let uuid: UUID
/// The level of confidence normalized to `[0, 1]` where `1` is most confident.
///
/// The only exception is results coming from `CoreMLRequest`, where confidence values are forwarded as is from relevant CoreML models
public let confidence: Float
/// The time range of the reported observation.
///
/// When evaluating a sequence of image buffers, use this property to determine each observation’s start time and duration.
public let timeRange: CMTimeRange?
/// 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.
public var description: String { get }
/// The descriptor of the request that produced the observation.
public let originatingRequestDescriptor: RequestDescriptor?
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: SaliencyImageObservation, b: SaliencyImageObservation) -> Bool
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
}
extension
SaliencyImageObservation
NewwatchOSextension SaliencyImageObservation : Codable
Declaration
extension SaliencyImageObservation : Codable {
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
struct
SmudgeObservation
NewwatchOSpublic struct SmudgeObservation : VisionObservation
An observation that provides a confidence score indicating the presence of a smudge in an image or video frame capture.
Declaration
public struct SmudgeObservation : VisionObservation {
/// The unique identifier for the observation.
public let uuid: UUID
/// The level of confidence in the observation's accuracy of smudge detection on a lens.
///
/// The framework normalizes this value to [0, 1], where 1 represents a high probability that the lens was smudged at capture time.
public let confidence: Float
/// The time range of the reported observation.
///
/// When evaluating a sequence of image buffers, use this property to determine each observation’s start time and duration.
public let timeRange: CMTimeRange?
/// The descriptor of the request that produced the observation.
public let originatingRequestDescriptor: RequestDescriptor?
/// A textual representation of this instance.
public var description: String { get }
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: SmudgeObservation, b: SmudgeObservation) -> Bool
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
}
extension
SmudgeObservation
NewwatchOSextension SmudgeObservation : Codable
Declaration
extension SmudgeObservation : Codable {
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
protocol
StatefulRequest
NewwatchOSpublic protocol StatefulRequest : VisionRequest
A request type that builds evidence of a condition over time.
Declaration
public protocol StatefulRequest : VisionRequest {
/// The minimum number of frames that the request has to process on before reporting back any observation.
///
/// This information is provided by the request once initialized with its required paramters.
/// Video-based requests often need a minimum number of frames before they can report back any observation.
/// An example would be that a movement detection requires at least 5 frames to be detected.
/// The `minimumLatencyFrameCount` for that request would report 5 and only after 5 frames have been processed an observation would be returned in the results.
/// This latency is indicative of how responsive a request is in respect to the incoming data.
var minimumLatencyFrameCount: Int { get }
/// The reciprocal of maximum rate at which buffers will be processed.
///
/// The request will not process buffers that fall within the `frameAnalysisSpacing` since the previously performed analysis.
/// The analysis is not done by wall time but by analysis of of the time stamps of the samplebuffers being processed.
var frameAnalysisSpacing: CMTime { get }
}
extension
StatefulRequest
NewwatchOSextension StatefulRequest
Declaration
extension StatefulRequest {
/// Hashes the essential components of this value by feeding them into the
/// given hasher.
///
/// Implement this method to conform to the `Hashable` protocol. The
/// components used for hashing must be the same as the components compared
/// in your type's `==` operator implementation. Call `hasher.combine(_:)`
/// with each of these components.
///
/// - Important: In your implementation of `hash(into:)`,
/// don't call `finalize()` on the `hasher` instance provided,
/// or replace it with a different instance.
/// Doing so may become a compile-time error in the future.
///
/// - Parameter hasher: The hasher to use when combining the components
/// of this instance.
public func hash(into hasher: inout Hasher)
}
protocol
TargetedRequest
NewwatchOSpublic protocol TargetedRequest : VisionRequest
A request that can be used with a TargetedImageHandler to analyze two images together.
Declaration
public protocol TargetedRequest : VisionRequest {
}
struct
TextObservation
NewwatchOSpublic struct TextObservation : VisionObservation, QuadrilateralProviding
Declaration
public struct TextObservation : VisionObservation, QuadrilateralProviding {
/// An array of detected individual character bounding boxes.
///
/// If the associated `DetectTextRectanglesRequest` indicates interest in character boxes by setting the option `reportCharacterBoxes` to `true`,
/// this property is non-`nil`. If no characters are found, it remains empty.
public let characterBoxes: [RectangleObservation]?
/// The bounding box of the object.
///
/// The coordinate system is normalized to the dimensions of the processed image, with the origin at the lower-left corner of the image.
public let boundingBox: NormalizedRect
/// The coordinates of the upper-left corner of the quadrilateral.
public let topLeft: NormalizedPoint
/// The coordinates of the upper-right corner of the quadrilateral.
public let topRight: NormalizedPoint
/// The coordinates of the lower-right corner of the quadrilateral.
public let bottomRight: NormalizedPoint
/// The coordinates of the lower-left corner of the quadrilateral.
public let bottomLeft: NormalizedPoint
/// The unique identifier for the observation.
public let uuid: UUID
/// The level of confidence normalized to `[0, 1]` where `1` is most confident.
///
/// The only exception is results coming from `CoreMLRequest`, where confidence values are forwarded as is from relevant CoreML models
public let confidence: Float
/// The time range of the reported observation.
///
/// When evaluating a sequence of image buffers, use this property to determine each observation’s start time and duration.
public let timeRange: CMTimeRange?
/// The descriptor of the request that produced the observation.
public let originatingRequestDescriptor: RequestDescriptor?
/// 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.
public var description: String { get }
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: TextObservation, b: TextObservation) -> Bool
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
Truncated.
extension
TextObservation
NewwatchOSextension TextObservation : Codable
Declaration
extension TextObservation : Codable {
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
struct
TrajectoryObservation
NewwatchOSpublic struct TrajectoryObservation : VisionObservation
An observation that describes a detected trajectory.
Declaration
public struct TrajectoryObservation : VisionObservation {
/// The centroid points of the detected contour along the trajectory.
///
/// The detected points may differ slightly from the ideal trajectory because they fall within the allowed tolerance. The system limits the maximum number of points based on the maximum trajectory length set in the request.
public let detectedPoints: [NormalizedPoint]
/// The centroids of the calculated trajectory from the detected points.
///
/// The projected points define the ideal trajectory described by the parabolic equation. The equation’s coefficients and the projected points of the detected trajectory get refined over time. The system limits the maximum number of cached points to the maximum points needed to describe the trajectory together with the parabolic equation.
public let projectedPoints: [NormalizedPoint]
/// The coefficients of the parabolic equation.
///
/// This equation describes the parabola on which the detected contour is traveling. The equation and the projected points get refined over time.
public let equationCoefficients: simd_float3
/// The moving average radius of the object the request is tracking.
public let movingAverageRadius: CGFloat
/// The unique identifier for the observation.
public let uuid: UUID
/// The level of confidence normalized to `[0, 1]` where `1` is most confident.
///
/// The only exception is results coming from `CoreMLRequest`, where confidence values are forwarded as is from relevant CoreML models
public let confidence: Float
/// The time range of the reported observation.
///
/// When evaluating a sequence of image buffers, use this property to determine each observation’s start time and duration.
public let timeRange: CMTimeRange?
/// The descriptor of the request that produced the observation.
public let originatingRequestDescriptor: RequestDescriptor?
/// 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.
public var description: String { get }
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: TrajectoryObservation, b: TrajectoryObservation) -> Bool
/// The hash value.
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
///
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
/// The compiler provides an implementation for `hashValue` for you.
public var hashValue: Int { get }
Truncated.
extension
TrajectoryObservation
NewwatchOSextension TrajectoryObservation : Codable
Declaration
extension TrajectoryObservation : Codable {
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
enum
VisionError
NewwatchOSpublic enum VisionError : Error
Declaration
public enum VisionError : Error {
/// Required data is missing.
case dataUnavailable(String)
/// An internal error occurred within the framework.
case internalError(String)
/// A request was configured with an invalid value.
case invalidArgument(String)
/// Data is formatted incorrectly.
case invalidFormat(String)
/// The input image is invalid.
///
/// This error occurs when you pass an invalid image to an operation, such as passing an image with no dimensions.
case invalidImage(String)
/// The Core ML model is incompatible with the request.
case invalidModel(String)
/// An app requested an unsupported operation.
case invalidOperation(String)
/// An I/O error for an image, image sequence, or Core ML model.
case ioError(String)
/// The requested operation failed.
case operationFailed(String)
/// An app attempted to access data that’s out-of-bounds.
case outOfBoundsError(String)
/// There is not enough memory to perform the operation.
case outOfMemory(String)
/// An error occurred while creating a pixel buffer.
case pixelBufferCreationFailed(CVReturn)
/// An app cancelled the request.
case requestCancelled(String)
/// The operation timed out.
case timeout(String)
/// The system can’t find a timestamp.
case timeStampNotFound(String)
/// An app requested an unsupported compute device.
case unsupportedComputeDevice(String)
/// An app requested an unsupported compute stage.
case unsupportedComputeStage(String)
/// An app attempted an unsupported request.
case unsupportedRequest(String)
/// An app specified an unsupported request revision.
case unsupportedRevision(String)
}
extension
VisionError
NewwatchOSextension VisionError : LocalizedError
Declaration
extension VisionError : LocalizedError {
/// A localized message describing what error occurred.
public var errorDescription: String? { get }
}
extension
VisionError
NewwatchOSextension VisionError
Declaration
extension VisionError {
public var description: String { get }
}
protocol
VisionObservation
NewwatchOSpublic protocol VisionObservation : CustomStringConvertible, Decodable, Encodable, Hashable, Sendable
Declaration
public protocol VisionObservation : CustomStringConvertible, Decodable, Encodable, Hashable, Sendable {
/// The unique identifier for the observation.
var uuid: UUID { get }
/// The level of confidence normalized to `[0, 1]` where `1` is most confident.
///
/// The only exception is results coming from `CoreMLRequest`, where confidence values are forwarded as is from relevant CoreML models
var confidence: Float { get }
/// The time range of the reported observation.
///
/// When evaluating a sequence of image buffers, use this property to determine each observation’s start time and duration.
var timeRange: CMTimeRange? { get }
/// The descriptor of the request that produced the observation.
var originatingRequestDescriptor: RequestDescriptor? { get }
/// Hashes the essential components of this value by feeding them into the
/// given hasher.
///
/// Implement this method to conform to the `Hashable` protocol. The
/// components used for hashing must be the same as the components compared
/// in your type's `==` operator implementation. Call `hasher.combine(_:)`
/// with each of these components.
///
/// - Important: In your implementation of `hash(into:)`,
/// don't call `finalize()` on the `hasher` instance provided,
/// or replace it with a different instance.
/// Doing so may become a compile-time error in the future.
///
/// - Parameter hasher: The hasher to use when combining the components
/// of this instance.
override func hash(into hasher: inout Hasher)
/// 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.
override var description: String { get }
}
extension
VisionObservation
NewwatchOSextension VisionObservation
Declaration
extension VisionObservation {
/// Hashes the essential components of this value by feeding them into the
/// given hasher.
///
/// Implement this method to conform to the `Hashable` protocol. The
/// components used for hashing must be the same as the components compared
/// in your type's `==` operator implementation. Call `hasher.combine(_:)`
/// with each of these components.
///
/// - Important: In your implementation of `hash(into:)`,
/// don't call `finalize()` on the `hasher` instance provided,
/// or replace it with a different instance.
/// Doing so may become a compile-time error in the future.
///
/// - Parameter hasher: The hasher to use when combining the components
/// of this instance.
public func hash(into hasher: inout Hasher)
}
protocol
VisionRequest
NewwatchOSpublic protocol VisionRequest : CustomStringConvertible, Hashable, Sendable
A protocol for Vision analysis requests.
Declaration
public protocol VisionRequest : CustomStringConvertible, Hashable, Sendable {
var supportedComputeStageDevices: [ComputeStage : [MLComputeDevice]] { get }
/// Returns the compute device for a compute stage.
///
/// - Parameters:
/// - `computeStage: `The compute stage to inspect.
///
/// - Returns: The current compute device; otherwise, `nil` if one isn’t assigned.
func computeDevice(for computeStage: ComputeStage) -> MLComputeDevice?
/// Assigns a compute device for a compute stage.
///
/// If the parameter `computeDevice` is `nil`, the framework removes any explicit compute device assignment and allows the framework to select the device.
/// Configure any compute device for a given compute stage. When performing a request, the system makes a validity check. Use `supportedComputeStageDevices` to get valid compute devices for a request’s compute stages.
///
/// - Parameters:
/// - `computeDevice: `The compute device to assign to the compute stage.
/// - `computeStage: `The compute stage.
mutating func setComputeDevice(_ computeDevice: MLComputeDevice?, for computeStage: ComputeStage)
/// An enum that identifies the request and request revision.
var descriptor: RequestDescriptor { get }
/// The type produced by performing a Request.
///
/// This type will either be a single VisionObservation or array of VisionObservations.
associatedtype Result
}
extension
VisionRequest
NewwatchOSextension VisionRequest
Declaration
extension VisionRequest {
/// Returns the compute device for a compute stage.
///
/// - Parameters:
/// - `computeStage: `The compute stage to inspect.
///
/// - Returns: The current compute device; otherwise, `nil` if one isn’t assigned.
public func computeDevice(for computeStage: ComputeStage) -> MLComputeDevice?
/// 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.
public var description: String { get }
}
enum
VisionResult
NewwatchOSpublic enum VisionResult : Sendable
Declaration
public enum VisionResult : Sendable {
case detectFaceRectangles(DetectFaceRectanglesRequest, [FaceObservation])
case detectHumanRectangles(DetectHumanRectanglesRequest, [HumanObservation])
case error(any VisionRequest, any Error)
case calculateImageAestheticsScores(CalculateImageAestheticsScoresRequest, ImageAestheticsScoresObservation)
case classifyImage(ClassifyImageRequest, [ClassificationObservation])
case coreML(CoreMLRequest, [any VisionObservation])
case detectBarcodes(DetectBarcodesRequest, [BarcodeObservation])
case detectContours(DetectContoursRequest, ContoursObservation)
case detectDocumentSegmentation(DetectDocumentSegmentationRequest, DetectedDocumentObservation?)
case detectFaceCaptureQuality(DetectFaceCaptureQualityRequest, [FaceObservation])
case detectFaceLandmarks(DetectFaceLandmarksRequest, [FaceObservation])
case detectHorizon(DetectHorizonRequest, HorizonObservation?)
@available(macOS 26.0, iOS 26.0, tvOS 26.0, watchOS 27.0, *)
case detectLensSmudge(DetectLensSmudgeRequest, SmudgeObservation)
case detectRectangles(DetectRectanglesRequest, [RectangleObservation])
case detectTrajectories(DetectTrajectoriesRequest, [TrajectoryObservation])
case generateAttentionBasedSaliencyImage(GenerateAttentionBasedSaliencyImageRequest, SaliencyImageObservation)
case generateImageFeaturePrint(GenerateImageFeaturePrintRequest, FeaturePrintObservation)
case generateForegroundInstanceMask(GenerateForegroundInstanceMaskRequest, InstanceMaskObservation?)
case generateObjectnessBasedSaliencyImage(GenerateObjectnessBasedSaliencyImageRequest, SaliencyImageObservation)
case generatePersonSegmentation(GeneratePersonSegmentationRequest, PixelBufferObservation)
case generatePersonInstanceMask(GeneratePersonInstanceMaskRequest, InstanceMaskObservation?)
case recognizeAnimals(RecognizeAnimalsRequest, [RecognizedObjectObservation])
case trackHomographicImageRegistration(TrackHomographicImageRegistrationRequest, ImageHomographicAlignmentObservation)
case trackObject(TrackObjectRequest, DetectedObjectObservation?)
case trackRectangle(TrackRectangleRequest, RectangleObservation?)
case trackTranslationalImageRegistration(TrackTranslationalImageRegistrationRequest, ImageTranslationAlignmentObservation)
}
extension
VisionResult
NewwatchOSextension VisionResult : Equatable, CustomStringConvertible
Declaration
extension VisionResult : Equatable, CustomStringConvertible {
/// 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.
public var description: String { get }
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (lhs: VisionResult, rhs: VisionResult) -> Bool
}
typealias
BarcodeReaderTool.Output
NewiOSmacOSwatchOSpublic typealias Output = some PromptRepresentable
The output that this tool produces for the language model to reason about in subsequent interactions.
Typically output is either a String or a Generable type.
typealias
BarcodeReaderTool.Arguments.PartiallyGenerated.ID
NewiOSmacOSwatchOSpublic typealias ID = GenerationID
A type representing the stable identity of the entity associated with an instance.
typealias
BarcodeSymbology.AllCases
NewwatchOSpublic typealias AllCases = [BarcodeSymbology]
A type that can represent a collection of all values of this type.
case
DetectFaceLandmarksRequest.Revision.revision4
NewiOSmacOStvOScase revision4
case
DetectFaceRectanglesRequest.Revision.revision4
NewiOSmacOStvOScase revision4
case
DetectHumanRectanglesRequest.Revision.revision3
NewiOSmacOStvOScase revision3
func
DownloadableAssetsRequest.downloadAssetsWithProgress
NewvisionOSfunc downloadAssetsWithProgress() throws -> DownloadableAssetsProgress
func
GenerateSelectedObjectSegmentationRequest.downloadWithProgress
NewvisionOSpublic func downloadWithProgress() throws -> DownloadableAssetsProgress
init
HumanObservation.init
NewwatchOSpublic init(boundingBox: NormalizedRect, revision: DetectHumanRectanglesRequest.Revision? = nil)
typealias
ImageCropAndScaleAction.AllCases
NewwatchOSpublic typealias AllCases = [ImageCropAndScaleAction]
A type that can represent a collection of all values of this type.
typealias
OCRTool.Output
NewiOSmacOSpublic typealias Output = some PromptRepresentable
The output that this tool produces for the language model to reason about in subsequent interactions.
Typically output is either a String or a Generable type.
typealias
OCRTool.Arguments.PartiallyGenerated.ID
NewiOSmacOSpublic typealias ID = GenerationID
A type representing the stable identity of the entity associated with an instance.
var
OpticalFlowObservation.pixelBuffer
NewiOSmacOStvOSwatchOSpublic var pixelBuffer: CVReadOnlyPixelBuffer { get }
var
PixelBufferObservation.pixelBuffer
NewiOSmacOStvOSwatchOSpublic var pixelBuffer: CVReadOnlyPixelBuffer { get }
typealias
QualityLevel.AllCases
NewiOSmacOStvOSpublic typealias AllCases = [GenerateIterativeSegmentationRequest.QualityLevel]
A type that can represent a collection of all values of this type.
typealias
QualityLevel.AllCases
NewwatchOSpublic typealias AllCases = [GeneratePersonSegmentationRequest.QualityLevel]
A type that can represent a collection of all values of this type.
typealias
RecognizeAnimalsRequest.Animal.RawValue
NewwatchOSpublic typealias RawValue = String
The raw type that can be used to represent all values of the conforming type.
Every distinct value of the conforming type has a corresponding unique value of the RawValue type, but there may be values of the RawValue type that don't have a corresponding value of the conforming type.
case
RequestDescriptor.detectLensSmudgeRequest
NewwatchOScase detectLensSmudgeRequest(DetectLensSmudgeRequest.Revision)
case
RequestDescriptor.generateIterativeSegmentationRequest
NewiOSmacOStvOScase generateIterativeSegmentationRequest(GenerateIterativeSegmentationRequest.Revision)
case
RequestDescriptor.generateSelectedObjectSegmentationRequest
NewvisionOScase generateSelectedObjectSegmentationRequest(GenerateSelectedObjectSegmentationRequest.Revision)
typealias
TrackingLevel.AllCases
NewwatchOSpublic typealias AllCases = [TrackRectangleRequest.TrackingLevel]
A type that can represent a collection of all values of this type.
case
VisionResult.detectLensSmudge
NewwatchOScase detectLensSmudge(DetectLensSmudgeRequest, SmudgeObservation)
case
VisionResult.generateIterativeSegmentation
NewiOSmacOStvOScase generateIterativeSegmentation(GenerateIterativeSegmentationRequest, PixelBufferObservation)
case
VNErrorCode.resourceCorrupted
NewiOSmacOStvOScase resourceCorrupted = 24
case
VNErrorCode.resourceUnavailable
NewiOSmacOStvOScase resourceUnavailable = 23
No APIs match your filter.