One Logo Pool Ball
Vision · IOS API REFERENCE

OpticalFlowObservation

struct · iOS 18.0+ · SDK 27.1

struct OpticalFlowObservation

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.

Members (10)

get · iOS 18.0+

confidence

TypeScript
get confidence(): number
Swift declaration
let confidence: Float

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

get · iOS 18.0+

description

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

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

get · iOS 27.0+

pixelBuffer

TypeScript
get pixelBuffer(): _CoreVideo_CVReadOnlyPixelBuffer
Swift declaration
var pixelBuffer: CVReadOnlyPixelBuffer { get }
get · iOS 18.0+

pixelFormat

TypeScript
get pixelFormat(): SDKHandle
Swift declaration
var pixelFormat: OSType { get }

The four-character code OSType identifier for the pixel format.

get · iOS 18.0+

originatingRequestDescriptor

TypeScript
get originatingRequestDescriptor(): (RequestDescriptor) | null
Swift declaration
let originatingRequestDescriptor: RequestDescriptor?

The descriptor of the request that produced the observation.

method · iOS 18.0+

flow

TypeScript
flow(point: NormalizedPoint): [number, number]
Swift declaration
func flow(at point: NormalizedPoint) -> (Float, Float)

Returns the optical flow for the specified location in the observation image

get · iOS 18.0+

size

TypeScript
get size(): { width: number; height: number }
Swift declaration
var size: CGSize { get }

The size of the observation image.

get · iOS 18.0+

uuid

TypeScript
get uuid(): string
Swift declaration
let uuid: UUID

The unique identifier for the observation.

get · iOS 18.0+

timeRange

TypeScript
get timeRange(): (_CoreMedia_CMTimeRange) | null
Swift declaration
let timeRange: CMTimeRange?

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.

init · iOS 18.0+

init

TypeScript
static init(observation: VNPixelBufferObservation): (OpticalFlowObservation) | null
Swift declaration
init?(_ observation: VNPixelBufferObservation)

Skipped declarations

1 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

OpticalFlowObservation.withUnsafePointer(_:)

callback cannot propagate synchronous failure

All Vision types →