Class

VNImageRequestHandler

An object that processes one or more image analysis requests pertaining to a single image.

Overview

Instantiate this handler to perform Vision requests on a single image. You specify the image and, optionally, a completion handler at the time of creation, and call perform(_:) to begin executing the request.

Topics

Initializing a Handler

init(cgImage: CGImage, options: [VNImageOption : Any] = [:])

Creates a handler to be used for performing requests on Core Graphics images.

init(cgImage: CGImage, orientation: CGImagePropertyOrientation, options: [VNImageOption : Any] = [:])

Creates a handler to be used for performing requests on a Core Graphics image with known orientation.

init(ciImage: CIImage, options: [VNImageOption : Any] = [:])

Creates a handler to be used for performing requests on CIImage data.

init(ciImage: CIImage, orientation: CGImagePropertyOrientation, options: [VNImageOption : Any] = [:])

Creates a handler to be used for performing requests on CIImage data of a known orientation.

init(cvPixelBuffer: CVPixelBuffer, options: [VNImageOption : Any] = [:])

Creates a handler to be used for performing requests on a Core Video pixel buffer.

init(cvPixelBuffer: CVPixelBuffer, orientation: CGImagePropertyOrientation, options: [VNImageOption : Any] = [:])

Creates a handler to be used for performing requests on a Core Video pixel buffer of a known orientation.

init(data: Data, options: [VNImageOption : Any] = [:])

Creates a handler to be used for performing requests on an image contained in an NSData object.

init(data: Data, orientation: CGImagePropertyOrientation, options: [VNImageOption : Any] = [:])

Creates a handler to be used for performing requests on an image of known orientation, contained in an NSData object.

init(url: URL, options: [VNImageOption : Any] = [:])

Creates a handler to be used for performing requests on an image at the specified URL.

init(url: URL, orientation: CGImagePropertyOrientation, options: [VNImageOption : Any] = [:])

Creates a handler to be used for performing requests on an image with known orientation, at the specified URL.

Executing a Handler

func perform([VNRequest])

Schedules Vision requests to be performed.

Setting Image Options

struct VNImageOption

An option key passed into VNImageRequestHandler creations or requests that take an auxiliary image.

Relationships

Inherits From

Conforms To

See Also

Still Image Analysis

Detecting Objects in Still Images

Locate and demarcate rectangles, faces, barcodes, and text in images using the Vision framework.

class VNImageBasedRequest

The abstract superclass for image analysis requests that focus on a specific part of an image.

class VNRequest

The abstract superclass for analysis requests.

class VNObservation

The abstract superclass for analysis results.