BlinkID / blinkid-ios

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

Update Recognizer Settings without dismissing the controller #102

Closed manomuthu-optisol closed 6 years ago

manomuthu-optisol commented 7 years ago

Hi,

i have been using blink id default view controller for scanning with MRTD , USDL and EUDL RecognizerSettings there was no issues in using that. But while include the face detection setting with that am getting an error as no privilege available . How to use face detection setting along with MRTD , USDL and EUDL RecognizerSettings. Kindly, give me an idea

Thanks in advance.

Regards, M.Muthukumar

ghost commented 6 years ago

HI @manomuthu-optisol!

If you are updating settings while scanning, make sure to call [coordiantor applySettings] after you update them. You should create face detector like this:

PPFaceDetectorSettings *faceDetectorSettings = [[PPFaceDetectorSettings alloc] init];
PPDetectorRecognizerSettings *detectorRecognizerSetting = [[PPDetectorRecognizerSettings alloc] initWithDetectorSettings:faceDetectorSettings]; 
[settings.scanSettings addRecognizerSettings:detectorRecognizerSetting];

// If you are doing this after presenting scanningViewController add this line: 
[coordinator applySettings];

Could you send us the code you use to create and add recognisers?

Regards, Jure

manomuthu-optisol commented 6 years ago

Hi Jure,

Kindly find the below file in which i have my code which am using.

scanCode.txt

ghost commented 6 years ago

Hi @manomuthu-optisol,

I went through your code and recreated the error you are getting. I noticed you have a docScanner function in which you create PPDetectorRecgonizerSettings so if you create PPFaceDetectorSettings and add another PPDetectorRecognizerSettings you will get this error. If you look into PPDetectorRecognizerSettings, you will see that the documentation says to create PPMultiDetectorSettings if you have multiple detectors, which you have. I can see you created PPMultiDetectorSettings, but you didn't add it to your PPDetectorRecognizerSettings. So if you want to have multiple detector setting at once you should add them all to your PPMultiDetectorSettings. I made a short example from your docScanner function:

// MULTI detector
let faceDetectorSettings = PPFaceDetectorSettings()

let multiDetectorSettings = PPMultiDetectorSettings.init(settingsArray: [documentDetectorSettings,mrtdDetectorSettings,faceDetectorSettings])

multiDetectorSettings?.allowMultipleResults = true

// Detector recognizer

let detectorRecognizerSettings = PPDetectorRecognizerSettings.init(detectorSettings: multiDetectorSettings!)

So make sure that you have max one PPDetectorRecognizerSettings in your PPSettings, if you need more detectors simultaneously create PPMultiDetectorSettings and add that to your PPDetectorRecognizerSettings. If you need a separate face detector recognizer, see PPDocumentFaceRecognizerSettings. Please let us know if this helps.

Kind regards, Jure

manomuthu-optisol commented 6 years ago

Hi jure,

Thanks for your help. Will implement the scenario which you have given and revert back to you as soon as possible.

Thanks and regards, M.Muthukumar

manomuthu-optisol commented 6 years ago

Hi jure,

Thanks a lot. PPDocumentFaceRecognizerSettings have done the trick which i have expected.

Regards, M.Muthukumar