BlinkID / blinkid-ios

Everything you need to add AI-driven ID scanning into your native iOS app.
https://microblink.com/products/blinkid
386 stars 89 forks source link

MBUsdlCombinedRecognizer documentDataMatch always returns true #233

Closed narendra-r closed 5 years ago

narendra-r commented 5 years ago

[READ] Step 1: Are you in the right place?

[REQUIRED] Step 2: Describe your environment

[REQUIRED] Step 3: Describe the problem

MBUsdlCombinedRecognizerResult documentDataMatch property always returns true on scan completion.

Steps to reproduce:

Scan different person's USDL back document on completion of front scan of USDL, then in results we always getting documentDataMatch property as true.

Relevant Code:

//setup recognizer
let usdlRecognizer = MBUsdlCombinedRecognizer()
usdlRecognizer.returnFullDocumentImage = true
usdlRecognizer.scanUncertain = false

// delegate
func documentVerificationOverlayViewControllerDidFinishScanning(_ documentVerificationOverlayViewController: MBDocumentVerificationOverlayViewController, state: MBRecognizerResultState) {
        // this is done on background thread
        // check for valid state
        if state == MBRecognizerResultState.valid {
            // first, pause scanning until we process all the results
            documentVerificationOverlayViewController.recognizerRunnerViewController?.pauseScanning()

            DispatchQueue.main.async(execute: {() -> Void in
                documentVerificationOverlayViewController.dismiss(animated: false, completion: {

                })

                self.parseResult(recognizer: self.recognizer)
                // Supporting only USDL combine here now
                if let recognizer = self.recognizer as? MBUsdlCombinedRecognizer, recognizer.result.documentDataMatch == true {
                 // *********** Its always coming here even with mismatched cards ****************
                   print("both sides of cards matched.. success")
                } else {
                        showAlert(title: "Error", message: "Data not matched", vc: self, okAction: {

                        })
                }
            })
        }
    }
jcular commented 5 years ago

Hi @narendra-r,

that's because the MBUSDLCombinedRecognizer scans only the face and document image on the front. It doesn't read the fields, all other fields are read from the pdf417 barcode on the backside, so it can't compare front and back side results.

Kind regards, Jure

narendra-r commented 5 years ago

Hi Jure, many thanks for your response. I have been reading your documentation. Specifically: http://blinkid.github.io/blinkid-ios/Protocols/MBCombinedRecognizerResult.html#/c:objc(pl)MBCombinedRecognizerResult(py)documentDataMatch.

As you will see, this document clearly suggests that BlinkID supports data comparison of USA Drivers license front and back. This has now become an important expectation for my client. Can you please look at this again and let me know whether if it is supported - or if it will be fixed? Thanks again for your help!

jcular commented 5 years ago

Unfortunately we don't currently support data matching on front and back side of usdl using USDL combined recognizer.