Setup Accura Finger
Add license file in to your project.
key.license
To generate your Accura license contact sales@accurascan.com
To initialize sdk on app start:
import AccuraFinger
var accuraFingerWrapper = AccuraFingerWrapper()
let sdkModel = self.accuraFingerWrapper.loadEngine(NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0] as String)
if(sdkModel != nil){
if sdkModel!.i > 0 {
print(sdkModel?.isFingerEnable ?? false)
}
}
Set CameraView
Important Grant Camera and storage Permission. supports Landscape Camera
import AccuraFinger
import AVFoundation
var accuraFingerWrapper: AccuraFingerWrapper? = nil
var bothThumbStoreImages: [UIImage] = []
var leftThumbImages: [UIImage] = []
var rightThumbImages: [UIImage] = []
var leftFingerImages: [UIImage] = []
var rightFingerImages: [UIImage] = []
override func viewDidLoad() {
super.viewDidLoad()
self.accuraFingerWrapper = AccuraFingerWrapper.init(delegate: self, andImageView: self._imageView, scanType: Int32(scanType)/*set 0 for verify and 1 for Enroll*/, whichFinger: Int32(whichFinger)/*set 0 for left Finger and 1 for right finger and 2 for left thumb and 3 for right thumb and 4 for both thumb)
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
self.accuraFingerWrapper?.startCamera()
}
extension ViewController: VideoCameraWrapperDelegate{
// It gets call on every Frame
func processedImage(_ image: UIImage!) {
}
//It gets rect of the finger
func array(ofRect arrayOfRect: NSMutableDictionary!) {
}
//It gets rect of the thumb
func array(ofRectThumb arrayOfRect: NSMutableDictionary!) {
}
//It gets Enroll images of finger
func fingerImages(_ index: UIImage!, index2: UIImage!, index3: UIImage!, middle: UIImage!, middle2: UIImage!, middle3: UIImage!, ring: UIImage!, ring2: UIImage!, ring3: UIImage!, little: UIImage!, little2: UIImage!, little3: UIImage!, imageArr ImageArr: NSMutableArray!) {
if self.whichFinger == 0 {
leftFingerImages.append(contentsOf: [index, index2, index3, middle, middle2, middle3, ring, ring2, ring3, little, little2, little3])
}else{
rightFingerImages.append(contentsOf: [index, index2, index3, middle, middle2, middle3, ring, ring2, ring3, little, little2, little3])
}
}
//It gets Enroll images of thumb
func thumbImages(_ thumb1: UIImage!, thumb2: UIImage!, thumb3: UIImage!, imageArr ImageArr: NSMutableArray!) {
if(whichFinger == 2){
leftThumbImages = [thumb1, thumb2, thumb3]
}else{
rightThumbImages = [thumb1, thumb2, thumb3]
}
}
//It gets Enroll images of both thumb
func bothThumbImages(_ lthumb1: UIImage!, lThumb2 lthumb2: UIImage!, lThumb3 lthumb3: UIImage!, rThumb1 rthumb1: UIImage!, rThumb2 rthumb2: UIImage!, rThumb3 rthumb3: UIImage!, imageArr ImageArr: NSMutableArray!) {
bothThumbStoreImages= [lthumb1, lthumb2, lthumb3, rthumb1, rthumb2, rthumb3]
}
//It gets Verfy images of finger
func verifyImages(_ index: UIImage!, middle: UIImage!, ring: UIImage!, little: UIImage!, imageArr ImageArr: NSMutableArray!){
let arrImage1:[UIImage] = [index,middle,ring,little]
var verifyImageTemplate:[String] = []
for img in arrImage1 {
verifyImageTemplate.append(accuraFingerWrapper?.getTemplate(img) ?? "")
}
var storeImageTemplate:[String] = []
if(whichFinger == 0){
for img in leftFingerImages {
storeImageTemplate.append(accuraFingerWrapper?.getTemplate(img) ?? "")
}
}else{
for img in rightFingerImages {
storeImageTemplate.append(accuraFingerWrapper?.getTemplate(img) ?? "")
}
}
let isValid = accuraFingerWrapper?.getFingerScore(storeImageTemplate[0], fingerIndexE2: storeImageTemplate[1], fingerIndexE3: storeImageTemplate[2],
fingerMiddleE1: storeImageTemplate[3],fingerMiddleE2: storeImageTemplate[4],fingerMiddleE3: storeImageTemplate[5],fingerRingE1: storeImageTemplate[6],
fingerRingE2: storeImageTemplate[7],fingerRingE3: storeImageTemplate[8],fingerLittleE1: storeImageTemplate[9],fingerLittleE2: storeImageTemplate[10],
fingerLittleE3:storeImageTemplate[11],fingerIndexV: verifyImageTemplate[0],fingerMiddleV: verifyImageTemplate[1],fingerRingV: verifyImageTemplate[2],
fingerLittleV: verifyImageTemplate[3])
}
//It gets Verfy images of both thumb
func verifyThumbImages(_ thumbLeft: UIImage!, thumbRight: UIImage!, imageArr ImageArr: NSMutableArray!) {
var arrImage1:[UIImage] = [thumbLeft,thumbRight]
var verifyImageTemplate:[String] = []
for img in arrImage1 {
verifyImageTemplate.append(accuraFingerWrapper?.getTemplate(img) ?? "")
}
var storeImageTemplate:[String] = []
for img in bothThumbStoreImages {
storeImageTemplate.append(accuraFingerWrapper?.getTemplate(img) ?? "")
}
let isValid = accuraFingerWrapper?.getBothThumbScore(storeImageTemplate[0], thumbEL2: storeImageTemplate[1], thumbEL3: storeImageTemplate[2],
thumbER1: storeImageTemplate[3], thumbER2: storeImageTemplate[4], thumbER3: storeImageTemplate[5], thumbVL: verifyImageTemplate[0],
thumbVR: verifyImageTemplate[1])
}
//It gets Verfy images of thumb
func verifyThumbImages(_ thumb: UIImage!, imageArr ImageArr: NSMutableArray!) {
var verifyImageTemplate:[String] = []
verifyImageTemplate.append(accuraFingerWrapper?.getTemplate(thumb) ?? "")
var storeImageTemplate:[String] = []
var leftThumbScores:[Double] = []
var rightThumbScores:[Double] = []
if(whichFinger == 2){
for img in leftThumbImages {
storeImageTemplate.append(accuraFingerWrapper?.getTemplate(img) ?? "")
}
}else{
for img in rightThumbImages {
storeImageTemplate.append(accuraFingerWrapper?.getTemplate(img) ?? "")
}
}
let isValid = accuraFingerWrapper?.getThumbScore(storeImageTemplate[0], thumbE2: storeImageTemplate[1], thumbE3: storeImageTemplate[2],
thumbV: verifyImageTemplate[0])
}
//It gets Error Message
func onUpdateProcess(_ msg: String!){
}
//It gets Finger Failure error
func biffurcationError(_ arrError: NSMutableArray!) {
}
//It gets Finger Acception result
func fingerAccepted(_ finger1: Bool, finger2: Bool, finger3: Bool, finger4: Bool, fingerBif: String!, fingerDist: String!,fingerEnd:String!, reset: Bool) {
}
//It gets Thumb Acception result
func thumbAccepted(_ thumb1: Bool, reset: Bool) {
}
//It gets Both Thumb Acception result
func bothThumbAccepted(_ thumb1: Bool, thumb2: Bool, reset: Bool) {
}
//It gets called for handling completion bar
func finger1() {}
func finger2() {}
func finger3() {}
func finger4() {}
Last updated