BlinkID / blinkid-ios

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

MBDocumentVerificationSubview outside MBDocumentVerificationOverlayViewController bounds #261

Closed denismullaraj closed 5 years ago

denismullaraj commented 5 years ago

208

[REQUIRED] Step 2: Describe your environment

[REQUIRED] Step 3: Describe the problem

I am testing out to use MBDocumentVerificationOverlayViewController and I add the recognizerRunnerViewController got from the MBViewControllerFactory to a view that has width 700 px approximatelly. Like this:

let containerViewController = MBViewControllerFactory.recognizerRunnerViewController(withOverlayViewController: documentVerificationOverlayVC)

containerViewController.willMove(toParent: self)
self.addChild(containerViewController)
containerViewController.didMove(toParent: self)
self.scanningContainerView.subviews.first?.removeFromSuperview()
containerViewController.view.translatesAutoresizingMaskIntoConstraints = true
containerViewController.view.frame = self.scanningContainerView.bounds
self.scanningContainerView.addSubview(containerViewController.view)

But when loaded, the overlay has a MBDocumentVerificationSubview which is going outside the bounds of my view. So it has a width bigger than 700px, in this case around 850px.

As you can see from the screenshot, the blue/purple selected view which is MBDocumentVerificationSubview is bigger than the container that is holding the camera view. How can I enforce it to be within the boundaries of my view?

Screenshot 2019-09-09 at 10 39 25
culoi commented 5 years ago

Hi @denismullaraj This is a preset overlay and you are not able to modify it.

You have to build a custom overlay as shown in the example here: https://github.com/BlinkID/blinkid-ios/tree/master/Samples/pdf417-sample-Swift

I also want to mention that this overlay is generated after a quite long testing and inputs from our users, and if you modify the size and build custom Overlay, please do not reduce the size of the scanning view, as with the sample that you showed, ID card will be moved quite away from the device (as users will try to fit ID inside the view) and this can cause document as unreadable.

The more portion of the screen ID fills, the better for recognition.

Regards

denismullaraj commented 5 years ago

Thank you :)