If you have any questions, feel free to contact us at support@regulaforensics.com
- How to build demo application
- How to use DocumentReader library
- How to add DocumentReader library to your project
- Additional information
- Get trial license for demo application at licensing.regulaforensics.com (
regula.license
file). - Clone current repository using command
git clone https://github.com/regulaforensics/RegulaDocumentReader-iOS.git
. - Download and install lates Xcode.
- Download latest DocumentReader.framework and copy it to
RegulaDocumentReader
folder. - Download OpenCV-2.4.9 and copy it to
RegulaDocumentReader
folder. - Copy file
regula.license
toRegulaDocumentReader/DocumentReaderDemo
folder. - Open project
RegulaDocumentReader/DocumentReaderDemo.xcodeproj
in Xcode. - Select Product/ Build menu command.
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.
You can use DocumentReader.framework
like any other framework.
- Open your project in Xcode.
- Drag and drop
DocumentReader.framework
to Project Navigator. - Check Destination checkbox and select Create folder references in Added folders group.
- Add bridging header for
DocumentReader.framework
.
If you have any questions, feel free to contact us at support@regulaforensics.com