Skip to content

iOS framework that detects an ID card in a camera view and returns the de-warped image of the ID card.

License

Notifications You must be signed in to change notification settings

AppliedRecognition/ID-Card-Camera

Repository files navigation

Cocoapods

ID Card Camera

  • Detects an ID card in a camera view and returns the de-warped image of the ID card.
  • Scans PDF417 barcode on the back side of an ID card.

Installation

Using CocoaPods

Add the following pod in your Podfile and run pod install.

pod 'ID-Card-Camera', '~> 1.0'
  • In Xcode select File -> Add Packages ... from the top menu.
  • Enter https://github.com/AppliedRecognition/ID-Card-Camera.git in the search bar.
  • Click the Add Package button.

Usage

import UIKit
import IDCardCamera

class ViewController: UIViewController, CardDetectionViewControllerDelegate {

    @IBOutlet var imageView: UIImageView!

    func scanIDCard() {
        // Set the scan settings
        // In this example the aspect ratio is that of a typical credit card
        // The width and height units are not important
        let settings = CardDetectionSettings(width: 85.6, height: 53.98)

        // Create the view controller
        let controller = CardDetectionViewController()

        // Set the delegate that will receive the result
        controller.delegate = self

        // Present the card detection view controller
        self.present(controller, animated: true, completion: nil)
    }

    func cardDetectionViewController(_ viewController: CardDetectionViewController, didDetectCard image: CGImage, withSettings settings: CardDetectionSettings) {
        // The card has been scanned
        // Display the image in the image view
        self.imageView.image = UIImage(cgImage: image)
    }
}

About

iOS framework that detects an ID card in a camera view and returns the de-warped image of the ID card.

Resources

License

Stars

Watchers

Forks

Packages

No packages published