import AccuraOCR
var accuraCameraWrapper: AccuraCameraWrapper? = nil
var arrCountryList = NSMutableArray()
accuraCameraWrapper = AccuraCameraWrapper.init()
let sdkModel = accuraCameraWrapper.loadEngine(your PathForDirectories)
if (sdkModel.i > 0) {
if(sdkModel!.isBankCardEnable) {
self.arrCountryList.add("Bank Card")
}
if(sdkModel!.isMRZEnable) {
self.arrCountryList.add("All MRZ")
// ID MRZ
// Visa MRZ
// Passport MRZ
// All MRZ
}
// if sdkModel.isOCREnable then get card data
if (sdkModel.isOCREnable) let countryListStr = self.videoCameraWrapper?.getOCRList();
if (countryListStr != null) {
for i in countryListStr!{
self.arrCountryList.add(i)
}
}
}
if(sdkModel!.isBarcodeEnable) {
self.arrCountryList.add("Barcode")
}
}
arrCountryList to get value(forKey: "card_name") //get card Name
arrCountryList to get value(forKey: "country_id") //get country id
arrCountryList to get value(forKey: "card_id") //get card id
To initialize Doc Liveness:
Optional: Load License File Dynamically
If you prefer to place the license file dynamically, you can use the following function. This method allows you to specify the license file path at runtime
Note:- For a demo of dynamic licensing, please refer to the branch "dynamic_license_demo".
Update filters config like below.
Call this function after initialize sdk if license is valid(sdkModel.i > 0)
Set Blur Percentage to allow blur on document
Set Blur Face Percentage to allow blur on detected Face
Set Glare Percentage to detect Glare on document
Set Photo Copy to allow photocopy document or not
Set Hologram detection to verify the hologram on the face
Set Low Light Tolerance to allow lighting to detect documant
Set motion threshold to detect motion on camera document
self.accuraCameraWrapper?.isApiCallingEnable(true) //Enable Disable Doc Liveness
self.accuraCameraWrapper?.apiurl("Your URL") //Add Your Doc Liveness URL
self.accuraCameraWrapper?.setProgressDialogue("API loading...") //Change the Progress Dialogue
self.accuraCameraWrapper?.apiTimer(100.0) //Update the Api Timer
var apiHeader = [ "Accept": "application/json"] // Example of Header
self.accuraCameraWrapper?.apiheader(apiHeader)
let documentDirectory = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0] as String
let sdkModel = accuraCameraWrapper?.loadEngine("Your License Path", documentDirectory: documentDirectory)
// 0 for clean document and 100 for Blurry document
self.accuraCameraWrapper?.setBlurPercentage(60/*blurPercentage*/)
// 0 for clean face and 100 for Blurry face
accuraCameraWrapper?.setFaceBlurPercentage(80/*faceBlurPercentage*/)
// Set min and max percentage for glare
accuraCameraWrapper?.setGlarePercentage(6/*minPercentage*/, 98/*maxPercentage*/)
// Set allow photocopy document or not
accuraCameraWrapper?.setCheckPhotoCopy(false/*isCheckPhotoCopy*/)
// true to check hologram on face
accuraCameraWrapper?.setHologramDetection(true/*isDetectHologram*/)
// 0 for full dark document and 100 for full bright document
accuraCameraWrapper?.setLowLightTolerance(10/*lowlighttolerance*/)
// 1 - allows 1% motion on document and
// 100 - it can not detect motion and allow document to scan.
accuraCameraWrapper?.setMotionThreshold(25/*setMotionThreshold*/)