Skip to content

Commit

Permalink
added 11.5.6
Browse files Browse the repository at this point in the history
  • Loading branch information
sMaltsevAcuant committed Jul 13, 2022
1 parent 0727c13 commit 4ad05da
Show file tree
Hide file tree
Showing 386 changed files with 71,888 additions and 4,215 deletions.
28 changes: 22 additions & 6 deletions AcuantCamera/AcuantCamera/Camera/Mrz/OCR/AcuantMrzResult.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,38 @@

import Foundation

@objcMembers public class AcuantMrzResult : NSObject{
public var surName:String = ""
public var givenName:String = ""
public var country:String = ""
@objcMembers public class AcuantMrzResult: NSObject {
public var surName: String = ""
public var givenName: String = ""
public var country: String = ""
public var passportNumber: String = ""
public var nationality:String = ""
public var nationality: String = ""
public var dob: String = ""
public var gender: String = ""
public var passportExpiration: String = ""
public var personalDocNumber: String = ""
public var checkSumChar1: String = ""
public var optional1: String = ""
public var checkSumResult1: Bool = false
public var checkSumResult2: Bool = false
public var checkSumResult3: Bool = false
public var checkSumResult4: Bool = false
public var checkSumResult5: Bool = false
public var threeLineMrz: Bool = false
var checkSumDigit1: String = ""
var checkSumDigit2: String = ""
var checkSumDigit3: String = ""
var checkSumDigit4: String = ""
var checkSumDigit5: String = ""

func cleanFields(character: String = "<") {
surName = surName.replacingOccurrences(of: character, with: "")
givenName = givenName.replacingOccurrences(of: character, with: "")
country = country.replacingOccurrences(of: character, with: "")
passportNumber = passportNumber.replacingOccurrences(of: character, with: "")
nationality = nationality.replacingOccurrences(of: character, with: "")
dob = dob.replacingOccurrences(of: character, with: "")
gender = gender.replacingOccurrences(of: character, with: "")
passportExpiration = passportExpiration.replacingOccurrences(of: character, with: "")
personalDocNumber = personalDocNumber.replacingOccurrences(of: character, with: "")
}
}
17 changes: 8 additions & 9 deletions AcuantCamera/AcuantCamera/Camera/Mrz/OCR/AcuantOcrDetector.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,26 @@
import Foundation
import TesseractOCR

public class AcuantOcrDetector{
let tesseract : G8Tesseract?
public class AcuantOcrDetector {
let tesseract: G8Tesseract?
var isInitalized = false

public init(){
tesseract = G8Tesseract(language: "OCRB")
if let success = tesseract{
if let success = tesseract {
isInitalized = true
success.pageSegmentationMode = .auto
success.charWhitelist = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ<"
}
}

public func detect(image: UIImage) -> String?{
if(self.isInitalized){
public func detect(image: UIImage) -> String? {
if self.isInitalized {
self.tesseract!.image = image
if(self.tesseract!.recognize()){
if self.tesseract!.recognize() {
return self.tesseract!.recognizedText!
}
else{
return nil;
} else {
return nil
}
}
return nil
Expand Down
Loading

0 comments on commit 4ad05da

Please sign in to comment.