<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 18.0.0 -",
    "visionOS: 2.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Vision",
  "identifier" : "/documentation/Vision/OpticalFlowObservation",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Vision"
    ],
    "preciseIdentifier" : "s:6Vision22OpticalFlowObservationV"
  },
  "title" : "OpticalFlowObservation"
}
-->

# OpticalFlowObservation

An object that represents an optical flow that an image-analysis request produces.

```
struct OpticalFlowObservation
```

## Overview

The optical flow is a 2D image, with each pixel representing the directional change from a previous to current image.

## Topics

### Creating an observation

[`init?(VNPixelBufferObservation)`](/documentation/Vision/OpticalFlowObservation/init(_:))

Creates an optical flow observation.

### Inspecting an observation

[`var pixelFormat: OSType`](/documentation/Vision/OpticalFlowObservation/pixelFormat)

The four-character code that identifies the pixel format.

[`var pixelBuffer: CVReadOnlyPixelBuffer`](/documentation/Vision/OpticalFlowObservation/pixelBuffer)

[`var size: CGSize`](/documentation/Vision/OpticalFlowObservation/size)

The size of the observation image.

### Getting the optical flow

[`func flow(at: NormalizedPoint) -> (Float, Float)`](/documentation/Vision/OpticalFlowObservation/flow(at:))

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

### Accessing the memory

[`func withUnsafePointer<R>((UnsafeRawPointer) -> R) -> R`](/documentation/Vision/OpticalFlowObservation/withUnsafePointer(_:))

Invokes the given closure with a pointer to the given argument.

## Relationships

### Conforms To

[`Hashable`](/documentation/Swift/Hashable)

[`Decodable`](/documentation/Swift/Decodable)

[`Equatable`](/documentation/Swift/Equatable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Sendable`](/documentation/Swift/Sendable)

[`Encodable`](/documentation/Swift/Encodable)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`VisionObservation`](/documentation/Vision/VisionObservation)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)