Recognito
  • About RECOGNITO
  • Face Recognition SDK
    • Performance Overview
    • Integration Guide
      • Linux
        • Installation
        • API Reference
        • Licensing
        • Sample Application
      • Windows
        • Installation
        • API Reference
        • Licensing
        • Sample Application
      • Android
        • Installation
        • API Reference
        • Licensing
        • Sample Application
      • iOS
        • Installation
        • API Reference
        • Licensing
        • Sample Application
      • Flutter
        • Installation
        • API Reference
        • Licensing
        • Sample Application
  • Face Liveness Detection SDK
    • Performance Overview
    • Integration Guide
      • Linux
        • Installation
        • API Reference
        • Licensing
        • Sample Application
      • Windows
        • Installation
        • API Reference
        • Licensing
        • Sample Application
      • Android
        • Installation
        • API Reference
        • Licensing
        • Sample Application
      • iOS
        • Installation
        • API Reference
        • Licensing
        • Sample Application
      • Flutter
        • Installation
        • API Reference
        • Licensing
        • Sample Application
  • ID Document Recognition SDK
    • Performance Overview
    • Integration Guide
      • Linux
        • Installation
        • API Reference
        • Licensing
        • Sample Application
      • Android
        • Installation
        • API Reference
        • Licensing
        • Sample Application
      • iOS
        • Installation
        • API Reference
        • Licensing
        • Sample Application
  • ID Document Liveness Detection SDK
    • Performance Overview
    • Integration Guide
      • Linux
        • Installation
        • API Reference
        • Licensing
        • Sample Application
  • License Option
  • How to implement 1:N identification with RECOGNITO SDK
  • Contact & Support
Powered by GitBook
On this page
  • Build Project
  • - Download and Open Project
  • - Setting Up SDK License Key
  • - Integration Guide
  • Application UI
  1. ID Document Recognition SDK
  2. Integration Guide
  3. iOS

Sample Application

ID Document Recognition iOS Demo

PreviousLicensingNextPerformance Overview

Last updated 5 months ago

Build Project

- Download and Open Project

  • Download

  • Open the IDCardRecognition-iOS project in Xcode.

- Setting Up SDK License Key

  • Add License key:

ViewController.swift
var ret = IDSDK.setActivation("QbxKmXkM8E2X+CzScRgJZlVxWxIlQL5Scimac/QMNoCeCEzEyCbrIdd0rKU09QO5Zz9/NiSGk0xd" +
     "T5TmKuLIAiwiac1GmOcF6yRH8+FeCfLAlX2yoyUI3EuXxgiJ9T+ZQD+y6cW9wOlO5vRxPtPD4H3t" +
     "xTXkgrUzvKvMNI3e+08jfb7WfJ0VTaL3qzcZtQa9btQT1bNl2baUrWlA5W08P8GETFJq4mjHHusQ" +
     "GUGx4a4OF78Rs2S3lbMs9XoeKy+aJEET/rPiubCf7Br1hytmYg9CDi+3mtdewL+6OCzWVntdKL4h" +
     "IRqd+LAWqGgBYbiVzM9lstNiqCuvDE0bJ4Fn0w==")
  • Build Project.

- Integration Guide

  • Activate and Initialize ID SDK

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view.
    
    var ret = IDSDK.setActivation("QbxKmXkM8E2X+CzScRgJZlVxWxIlQL5Scimac/QMNoCeCEzEyCbrIdd0rKU09QO5Zz9/NiSGk0xd" +
                       "T5TmKuLIAiwiac1GmOcF6yRH8+FeCfLAlX2yoyUI3EuXxgiJ9T+ZQD+y6cW9wOlO5vRxPtPD4H3t" +
                       "xTXkgrUzvKvMNI3e+08jfb7WfJ0VTaL3qzcZtQa9btQT1bNl2baUrWlA5W08P8GETFJq4mjHHusQ" +
                       "GUGx4a4OF78Rs2S3lbMs9XoeKy+aJEET/rPiubCf7Br1hytmYg9CDi+3mtdewL+6OCzWVntdKL4h" +
                       "IRqd+LAWqGgBYbiVzM9lstNiqCuvDE0bJ4Fn0w==")
    print("set activation: ", ret)
    if(ret == SDK_SUCCESS.rawValue) {
        ret = IDSDK.initSDK()
        print("init sdk: ", ret)
    }

}
  • Extract Data from Camera Frame

func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) {
    if(self.cameraRunning == false) {
        return
    }
    
    if(Date().timeIntervalSince1970 - startTime <= 1) {
        return
    }

    guard let pixelBuffer: CVPixelBuffer = CMSampleBufferGetImageBuffer(sampleBuffer) else { return }
           
    CVPixelBufferLockBaseAddress(pixelBuffer, CVPixelBufferLockFlags.readOnly)
    let image = CIImage(cvPixelBuffer: pixelBuffer).oriented(CGImagePropertyOrientation.right)
    
    let context = CIContext(options: nil)
    guard let cg = context.createCGImage(image, from: image.extent) else {
        CVPixelBufferUnlockBaseAddress(pixelBuffer, CVPixelBufferLockFlags.readOnly)
        return
    }

    let capturedImage = UIImage(cgImage: cg, scale: 1.0, orientation: .upMirrored).fixOrientation()
    CVPixelBufferUnlockBaseAddress(pixelBuffer, CVPixelBufferLockFlags.readOnly)
    
    let result = IDSDK.idcardRecognition(capturedImage) as NSDictionary

Application UI

IDCardRecognition-iOS.zip [147M]
5MB
id_recognition_ios.mp4