Need help with the integration?

Type a word or a phrase to start browsing through articles.

[BlinkID] ClassInfo: Filtering documents and getting document classification information

Follow

The BlinkID recognizer can obtain various document classification information with the ClassInfo property, for instance, document country, type, region etc., after the scanning process finishes.

Other than obtaining the classification information, the ClassInfo method can be used to filter out unwanted documents.

For instance, if a use-case only requires obtaining the information from US driving licenses, the ClassInfo can be modified so that the SDK will only accept scanning those documents, and reject any other document at the beginning of the scanning process.

Which information can be extracted via the ClassInfo method can be found here:

Brief code examples of how to obtain document classification information with ClassInfo:

Obtaining document classification information

Android:

BlinkIdCombinedRecognizer.Result result = recognizer.getResult();
classInfo = result.getClassInfo();
//Seeing if the document is USA drivers license
if (classInfo.getType() == Type.DL && classInfo.getCountry() == Country.USA) {
Toast.makeText(this,"This is drivers license from USA!", Toast.LENGTH_LONG).show();
}
//Retrieving information like documents' country ISO2 and country issuer
String iso2code = classInfo.getIsoAlpha2CountryCode();
String countryName = classInfo.getCountryName();
Toast.makeText(this, "Document country ISO2 code: " + iso2code + "\n Document country issuer: " + countryName, Toast.LENGTH_LONG).show();

iOS:

let result = self.blinkIdRecognizer?.result
let classInfo = result?.classInfo

//Seeing it the document is USA driver's license
if classInfo?.country == .usa && classInfo?.type == .typeDl {
  print("This is drivers license from USA!")
}
//Retriving information like documents' country ISO2 and country issuer
let iso2code = classInfo?.isoAlpha2CountryCode
let countryName = classInfo?.countryName

print("Document's country ISO2 code: \(iso2code)\nDocuments country issuer: \(countryName)")

Filtering out unwanted documents at the beginning of the scanning process

Android:

 

iOS:

  1. Add the MBBlinkIdRecognizerDelegate 

  2. Add the classInfoFilter method and the ClassInfo parameters needed for the scanning process:
    extension ViewController: MBBlinkIdOverlayViewControllerDelegate, MBBlinkIdRecognizerDelegate {
    func classInfoFilter(_ classInfo: MBClassInfo?) -> Bool {
    //The SDK will only accept US driver licenses and reject all of the documents
      if classInfo?.country == .usa && classInfo?.type == .typeDl {
          return true
      } else {
          return false
            }
        }
    }
  3. Where you're creating the BlinkID recognizer, set the classFilterDelegate:
    self.blinkIdRecognizer = MBBlinkIdRecognizer()
    self.blinkIdRecognizer?.classFilterDelegate = self
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments