<!--
{
  "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/TrackRectangleRequest",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Vision"
    ],
    "preciseIdentifier" : "s:6Vision21TrackRectangleRequestC"
  },
  "title" : "TrackRectangleRequest"
}
-->

# TrackRectangleRequest

An image-analysis request that tracks movement of a previously identified rectangular object across multiple images or video frames.

```
final class TrackRectangleRequest
```

## Overview

Use this type of request to track the bounding boxes of rectangles throughout a sequence of images. Vision returns locations for rectangles found in all orientations and sizes. The request returns the resulting rectangle data in an instance of [`RectangleObservation`](/documentation/Vision/RectangleObservation).

## Topics

### Creating a request

[`init(detectedRectangle: any QuadrilateralProviding & VisionObservation, TrackRectangleRequest.Revision?, frameAnalysisSpacing: CMTime?)`](/documentation/Vision/TrackRectangleRequest/init(detectedRectangle:_:frameAnalysisSpacing:))

Creates a rectangle tracking request.

### Performing a request

[`func perform(on: URL, orientation: CGImagePropertyOrientation?) async throws -> Self.Result`](/documentation/Vision/ImageProcessingRequest/perform(on:orientation:)-80bya)

Performs the request on an image URL and produces observations.

[`func perform(on: Data, orientation: CGImagePropertyOrientation?) async throws -> Self.Result`](/documentation/Vision/ImageProcessingRequest/perform(on:orientation:)-3f3f1)

Performs the request on image data and produces observations.

[`func perform(on: CGImage, orientation: CGImagePropertyOrientation?) async throws -> Self.Result`](/documentation/Vision/ImageProcessingRequest/perform(on:orientation:)-qxxx)

Performs the request on a Core Graphics image and produces observations.

[`func perform(on: CVPixelBuffer, orientation: CGImagePropertyOrientation?) async throws -> Self.Result`](/documentation/Vision/ImageProcessingRequest/perform(on:orientation:)-xspx)

Performs the request on a pixel buffer and produces observations.

[`func perform(on: CMSampleBuffer, orientation: CGImagePropertyOrientation?) async throws -> Self.Result`](/documentation/Vision/ImageProcessingRequest/perform(on:orientation:)-3hddl)

Performs the request on a Core Media buffer and produces observations.

[`func perform(on: CIImage, orientation: CGImagePropertyOrientation?) async throws -> Self.Result`](/documentation/Vision/ImageProcessingRequest/perform(on:orientation:)-85ex1)

Performs the request on a Core Image image and produces observations.

### Understanding the result

[`struct RectangleObservation`](/documentation/Vision/RectangleObservation)

An object that represents the four vertices of a detected rectangle.

### Configuring a request

[`let inputObservation: any QuadrilateralProviding & VisionObservation`](/documentation/Vision/TrackRectangleRequest/inputObservation)

The object to track.

[`protocol QuadrilateralProviding`](/documentation/Vision/QuadrilateralProviding)

A protocol for objects that have a bounding quadrilateral.

[`var trackingLevel: TrackRectangleRequest.TrackingLevel`](/documentation/Vision/TrackRectangleRequest/trackingLevel-swift.property)

The tracking quality preference.

[`enum TrackingLevel`](/documentation/Vision/TrackRectangleRequest/TrackingLevel-swift.enum)

### Getting the revision

[`let revision: TrackRectangleRequest.Revision`](/documentation/Vision/TrackRectangleRequest/revision-swift.property)

The algorithm or implementation the request uses.

[`static let supportedRevisions: [TrackRectangleRequest.Revision]`](/documentation/Vision/TrackRectangleRequest/supportedRevisions)

The collection of revisions the request supports.

[`enum Revision`](/documentation/Vision/TrackRectangleRequest/Revision-swift.enum)

A type that describes the algorithm or implementation that the request performs.

## Relationships

### Conforms To

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

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

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

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

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

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

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

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

---

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)