-
Notifications
You must be signed in to change notification settings - Fork 90
Using BlinkID recognizers
BlinkID recognizers include ID, passport, driver's license recognizers as well as generic recognizers such as MRTD recognizer for scanning MRZ. Concrete recognizers are listed at the bottom of this document.
If you completed Obtaining scanning results guide, you learned that in order to use a specific recognizer, you need to specify Recognizer Settings object in the initialization stage, and collect Recognizer Result object in the success callback.
Here we explain the general usage of BlinkID recognizers.
Back to "Getting started" guide.
Below is the sample source code which initializes the scanning for MRTD documents.
// To specify we want to perform MRTD (machine readable travel document) recognition, initialize the MRTD recognizer settings
PPMrtdRecognizerSettings *mrtdRecognizerSettings = [[PPMrtdRecognizerSettings alloc] init];
// Add MRTD Recognizer setting to a list of used recognizer settings
[settings.scanSettings addRecognizerSettings:mrtdRecognizerSettings];
Other BlinkID recognizers can be added the same way. Keep in mind that some recognizers have different properties which enable you to customize the scanning process for your specific use case. If you are using a specific recognizer we highly suggest listing through documentation of it's properties.
Retrieving results is described in Obtaining scanning results section.
Keep in mind that every specific recognizer has it's own result class. For example PPMrtdRecognizerSettings
used for initializing MRZ scanning outputs results as PPMrtdRecognizerResult
in scanningViewController:didOutputResults:
callback method.
BlinkID recognizers can retrieve dewarped images of documents. In addition, some recognizer can also include dewarped images of some specific document parts. For example Singapore ID recognizer can also retrieve dewarped image of owners portrait.
To retrieve dewarped images you need to:
- Enable output of dewarped images in
PPMetadataSettings
. This is done when creatingPPSettings
object.dewarpedImage
property must be set toYES
:
// Initialization of PPSettings. These settings will later be used for creation of PPCoordinator
PPSettings *settings = [[PPSettings alloc] init];
settings.metadataSettings.dewarpedImage = YES;
-
Enable output dewarped images for your recognizer. This step is not needed for all recognizers. Most recognizers have a property to enable outputting of dewarped images. This property must be set to
YES
. For example,PPSingaporeIDRecognizerSettings
has property nameddisplayFullDocumentImage
. -
Retrieve outputted images in
scanningViewController:didOutputMetadata:
callback method ofPPScanningDelegate
protocol. Below is sample source code of how this can be achieved:
- (void)scanningViewController:(UIViewController<PPScanningViewController> *)scanningViewController
didOutputMetadata:(PPMetadata *)metadata {
// Check whether outputted metadata is image
if ([metadata isKindOfClass:[PPImageMetadata class]]) {
PPImageMetadata *imageMetadata = (PPImageMetadata *)metadata;
/**
* Check whether outputted image is dewarped image. If only dewarped images are outputted this condition isn't needed.
* However, this can be useful if current or succesful frame outputs are also enabled in PPMetadataSettings explained in first step of this section
*/
if (imageMetadata.imageType == PPImageMetadataTypeDewarpedImage) {
UIImage *image = imageMetadata.image;
// process the image as you wish
}
}
}
- Getting Started with BlinkID SDK
- Obtaining scanning results
- Using Direct Processing API
- Customizing Camera UI
- Creating customized framework
- Upgrading from older versions
- Troubleshoot