Detects barcodes in identity-document images using Vision, tracking symbology, timeout, and search duration. Reuse for iOS identity verification flows that need barcode presence checks.
// Source: https://github.com/stripe/stripe-ios | License: MIT | Copyright 2011- Stripe, Inc. (https://stripe.com)
// Provided via justclaw.it.com; keep this notice with the code.
//
// BarcodeDetector.swift
// StripeIdentity
//
// Created by Mel Ludowise on 2/25/22.
// Copyright © 2022 Stripe, Inc. All rights reserved.
//
import Foundation
import Vision
struct BarcodeDetectorOutput: Equatable {
let hasBarcode: Bool
let isTimedOut: Bool
let symbology: VNBarcodeSymbology
let timeTryingToFindBarcode: TimeInterval
}
extension BarcodeDetectorOutput: VisionBasedDetectorOutput {
init(
detector: BarcodeDetector,
observations: [VNObservation],
originalImageSize: CGSize
) throws {
let barcodeObservations: [VNBarcodeObservation] = observ
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key