GestureRecognizerOptions
struct GestureRecognizerOptions: SendableConfiguration for initializing a GestureRecognizer.
Not Equatable or Hashable because liveStreamResultHandler is a closure.
-
init(baseOptions:runningMode:numHands:minHandDetectionConfidence:minHandPresenceConfidence:minTrackingConfidence:cannedGesturesClassifierOptions:customGesturesClassifierOptions:liveStreamResultHandler:)
Creates configuration options defaulting to
.imagemode and single-hand detection.Declaration
Swift
init(baseOptions: BaseOptions = BaseOptions(), runningMode: VisionRunningMode = .image, numHands: Int = 1, minHandDetectionConfidence: Float = 0.5, minHandPresenceConfidence: Float = 0.5, minTrackingConfidence: Float = 0.5, cannedGesturesClassifierOptions: ClassifierOptions = ClassifierOptions(), customGesturesClassifierOptions: ClassifierOptions = ClassifierOptions(), liveStreamResultHandler: GestureRecognizerOptions.LiveStreamResultHandler? = nil) -
Model asset loading and hardware acceleration settings.
Declaration
Swift
var baseOptions: BaseOptions -
Threshold and allowlist/denylist settings for built-in canned gestures.
Declaration
Swift
var cannedGesturesClassifierOptions: ClassifierOptions -
Threshold and allowlist/denylist settings for Model Maker custom gestures.
Declaration
Swift
var customGesturesClassifierOptions: ClassifierOptions -
Callback required when
runningMode == .liveStreamand disallowed in other modes.Declaration
Swift
var liveStreamResultHandler: GestureRecognizerOptions.LiveStreamResultHandler? -
Minimum confidence score (
[0.0, 1.0]) for palm detection (defaults to0.5).Declaration
Swift
var minHandDetectionConfidence: Float -
Minimum hand-presence confidence score (
[0.0, 1.0]) in landmark regression (0.5).Declaration
Swift
var minHandPresenceConfidence: Float -
Minimum landmark tracking confidence (
[0.0, 1.0]) across video/stream frames (0.5).Declaration
Swift
var minTrackingConfidence: Float -
Maximum number of hands detected per frame (defaults to
1).Declaration
Swift
var numHands: Int -
Execution mode (
.image,.video, or.liveStream).Declaration
Swift
var runningMode: VisionRunningMode -
Asynchronous callback receiving live-stream output and the frame timestamp in milliseconds.
Declaration
Swift
typealias LiveStreamResultHandler = @Sendable (Result<GestureRecognizerResult, any Error>, Int) -> Void