<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Vision",
  "identifier" : "/documentation/Vision/VNGenerateOpticalFlowRequest",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Vision"
    ],
    "preciseIdentifier" : "c:objc(cs)VNGenerateOpticalFlowRequest"
  },
  "title" : "VNGenerateOpticalFlowRequest"
}
-->

# VNGenerateOpticalFlowRequest

An object that generates directional change vectors for each pixel in the targeted image.

```
class VNGenerateOpticalFlowRequest
```

## Overview

This request operates at a pixel level, so both images need to have the same dimensions to successfully perform the analysis. Setting a region of interest limits the region in which the analysis occurs. However, the system reports the resulting observation at full resolution.

Optical flow requests are resource-intensive, so create only one request at a time, and release it immediately after generating optical flows.

## Topics

### Configuring the Request

[`computationAccuracy`](/documentation/Vision/VNGenerateOpticalFlowRequest/computationAccuracy-swift.property)

The accuracy level for computing optical flow.

[`VNGenerateOpticalFlowRequest.ComputationAccuracy`](/documentation/Vision/VNGenerateOpticalFlowRequest/ComputationAccuracy-swift.enum)

The supported optical flow accuracy levels.

[`outputPixelFormat`](/documentation/Vision/VNGenerateOpticalFlowRequest/outputPixelFormat)

The output buffer’s pixel format.

[`keepNetworkOutput`](/documentation/Vision/VNGenerateOpticalFlowRequest/keepNetworkOutput)

A Boolean value that indicates whether to keep the raw pixel buffer coming from the machine learning network.

### Accessing the Results

[`results`](/documentation/Vision/VNGenerateOpticalFlowRequest/results)

The results of the request to generate optical flow.

### Identifying Request Revisions

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

A constant for specifying revision 2 of the optical flow generation request.

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

A constant for specifying revision 1 of the optical flow generation request.



---

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)