Navigation Menu

Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

regulaforensics/RegulaDocumentReader-iOS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Regula Document Reader

If you have any questions, feel free to contact us at support@regulaforensics.com

How to build demo application

  1. Get trial license for demo application at licensing.regulaforensics.com (regula.license file).
  2. Clone current repository using command git clone https://github.com/regulaforensics/RegulaDocumentReader-iOS.git.
  3. Download and install lates Xcode.
  4. Download latest DocumentReader.framework and copy it to RegulaDocumentReader folder.
  5. Download OpenCV-2.4.9 and copy it to RegulaDocumentReader folder.
  6. Copy file regula.license to RegulaDocumentReader/DocumentReaderDemo folder.
  7. Open project RegulaDocumentReader/DocumentReaderDemo.xcodeproj in Xcode.
  8. Select Product/ Build menu command.

How to use DocumentReader library

The very first step you should make is install license file:

let mrzDetector = MRZDetectorIOS()
...
if let licenseFilePath = NSBundle.mainBundle().pathForResource("regula.license", ofType: nil) {
  let licenseData = NSData(contentsOfFile: licenseFilePath)
  let licenseOk = mrzDetector.setLicense(licenseData)
  if licenseOk {
    // License is OK, now we can use DocumentReader library
  } else {
    // License isn't OK, you can see additional information in output
  }
} else {
  // License file not found
}

License file contains information about your application id and time terms. If setLicense() method returns false, you can see additional information in output.

When the license file is installed, all you need to do is to call only one function to process image:

static func processMRZ(inImage: UIImage, inputIsSingleImage: Bool = true) -> Bool {
  var outputMrzImage: UIImage? = nil
  var outputMrzCoord: NSMutableArray? = nil
  var outputMrzXml: NSString? = nil
  let errorCode = mrzDetector.detectMRZ(
    inImage, 
    outputMRZImage: &outputMrzImage, 
    outputMRZCoords: &outputMrzCoord, 
    outputXML: &outputMrzXml, 
    writeDebugInfo: false, 
    inputIsSingleImage: inputIsSingleImage)
  return outputMrzXml != nil
}

For single image processing parameter inputIsSingleImage should be true. For video processing inputIsSingleImage parameter should be false. Parameter outputMrzXml contains parsed MRZ line.

How to add DocumentReader library to your project

You can use DocumentReader.framework like any other framework.

  1. Open your project in Xcode.
  2. Drag and drop DocumentReader.framework to Project Navigator.
  3. Check Destination checkbox and select Create folder references in Added folders group.
  4. Add bridging header for DocumentReader.framework.

Additional information

If you have any questions, feel free to contact us at support@regulaforensics.com