Skip to content

Commit

Permalink
Merge pull request #13 from BlinkID/feature/ios-v2.6.0
Browse files Browse the repository at this point in the history
Feature/ios v2.6.0
  • Loading branch information
Cerovec authored Feb 22, 2017
2 parents 3cec26b + a1f217b commit 8a60156
Show file tree
Hide file tree
Showing 5 changed files with 116 additions and 13 deletions.
38 changes: 38 additions & 0 deletions BlinkID/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "blinkid",
"version": "1.1.4",
"description": "A small and powerful ID card scanning library",
"cordova": {
"id": "com.microblink.blinkid",
"platforms": [
"android",
"ios"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/BlinkID/blinkid-phonegap.git"
},
"keywords": [
"ID",
"ecosystem:cordova",
"cordova-android",
"cordova-ios"
],
"engines": [
{
"name": "cordova",
"version": ">=3.0.0"
},
{
"name": "cordova-android",
"version": ">=4.0.0"
}
],
"author": "Microblink",
"license": "MIT",
"bugs": {
"url": "https://github.com/BlinkID/blinkid-phonegap/issues"
},
"homepage": "https://github.com/BlinkID/blinkid-phonegap#readme"
}
2 changes: 1 addition & 1 deletion BlinkID/src/ios/blinkid-ios
Submodule blinkid-ios updated 192 files
72 changes: 63 additions & 9 deletions BlinkID/src/ios/sources/CDVblinkIdScanner.m
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ - (PPPdf417RecognizerSettings *)pdf417RecognizerSettings {
* Set this to YES to scan barcodes which don't have quiet zone (white area) around it
* Use only if necessary because it slows down the recognition process
*/
pdf417RecognizerSettings.allowNullQuietZone = NO;
pdf417RecognizerSettings.allowNullQuietZone = YES;

/**
* Set this to YES to allow scanning barcodes with inverted intensities
Expand Down Expand Up @@ -253,21 +253,50 @@ - (PPEudlRecognizerSettings *)eudlRecognizerSettingsWithCountry:(PPEudlCountry)c
* Set this to NO if youre not interested in this data to speed up the scanning process!
*/
eudlRecognizerSettings.extractAddress = YES;



// This property is useful if you're at the same time obtaining Dewarped image metadata, since it allows you to obtain dewarped and cropped
// images of MRTD documents. Dewarped images are returned to scanningViewController:didOutputMetadata: callback,
// as PPImageMetadata objects with name @"MRTD"

if (self.shouldReturnCroppedDocument) {
eudlRecognizerSettings.showFullDocument = YES;
} else {
eudlRecognizerSettings.showFullDocument = NO;
}

return eudlRecognizerSettings;
}

- (PPDocumentFaceRecognizerSettings *)documentFaceRecognizerSettings {

PPDocumentFaceRecognizerSettings *documentFaceReconizerSettings = [[PPDocumentFaceRecognizerSettings alloc] init];

// This property is useful if you're at the same time obtaining Dewarped image metadata, since it allows you to obtain dewarped and cropped
// images of MRTD documents. Dewarped images are returned to scanningViewController:didOutputMetadata: callback,
// as PPImageMetadata objects with name @"MRTD"

if (self.shouldReturnCroppedDocument) {
documentFaceReconizerSettings.showFullDocument = YES;
} else {
documentFaceReconizerSettings.showFullDocument = NO;
}

return documentFaceReconizerSettings;
}

- (PPMyKadRecognizerSettings *)myKadRecognizerSettings {

PPMyKadRecognizerSettings *myKadRecognizerSettings = [[PPMyKadRecognizerSettings alloc] init];

/********* All recognizer settings are set to their default values. Change accordingly. *********/

/**
* If YES, full image of the document will be dewarped and returned via the API.
*/
myKadRecognizerSettings.showFullDocument = NO;
// This property is useful if you're at the same time obtaining Dewarped image metadata, since it allows you to obtain dewarped and cropped
// images of MRTD documents. Dewarped images are returned to scanningViewController:didOutputMetadata: callback,
// as PPImageMetadata objects with name @"MRTD"

if (self.shouldReturnCroppedDocument) {
myKadRecognizerSettings.showFullDocument = YES;
} else {
myKadRecognizerSettings.showFullDocument = NO;
}

return myKadRecognizerSettings;
}
Expand Down Expand Up @@ -308,6 +337,10 @@ - (BOOL)shouldUseDedlRecognizerForTypes:(NSArray *)types {
return [types containsObject:@"DEDL"];
}

- (BOOL)shouldUseDocumentFaceRecognizerForTypes:(NSArray *)types {
return [types containsObject:@"DocumentFace"];
}

- (BOOL)shouldUseMyKadRecognizerForTypes:(NSArray *)types {
return [types containsObject:@"MyKad"];
}
Expand Down Expand Up @@ -388,6 +421,10 @@ - (PPCameraCoordinator *)coordinatorWithError:(NSError**)error {
if ([self shouldUseDedlRecognizerForTypes:types]) {
[settings.scanSettings addRecognizerSettings:[self eudlRecognizerSettingsWithCountry:PPEudlCountryGermany]];
}

if ([self shouldUseDocumentFaceRecognizerForTypes:types]) {
[settings.scanSettings addRecognizerSettings:[self documentFaceRecognizerSettings]];
}

if ([self shouldUseMyKadRecognizerForTypes:types]) {
[settings.scanSettings addRecognizerSettings:[self myKadRecognizerSettings]];
Expand Down Expand Up @@ -422,6 +459,9 @@ - (void)scan:(CDVInvokedUrlCommand*)command {

/** Allocate and present the scanning view controller */
UIViewController<PPScanningViewController>* scanningViewController = [PPViewControllerFactory cameraViewControllerWithDelegate:self coordinator:coordinator error:nil];

scanningViewController.autorotate = YES;


/** You can use other presentation methods as well */
[[self viewController] presentViewController:scanningViewController animated:YES completion:nil];
Expand Down Expand Up @@ -486,6 +526,11 @@ - (void)setDictionary:(NSMutableDictionary*)dict withMyKadRecognizerResult:(PPMy
[dict setObject:@"MyKad result" forKey:@"resultType"];
}

- (void)setDictionary:(NSMutableDictionary*)dict withDocumentFaceResult:(PPDocumentFaceRecognizerResult*)documentFaceResult {
[dict setObject:[documentFaceResult getAllStringElements] forKey:@"fields"];
[dict setObject:@"DocumentFace result" forKey:@"resultType"];
}

- (void)returnResults:(NSArray *)results cancelled:(BOOL)cancelled {

NSMutableDictionary* resultDict = [[NSMutableDictionary alloc] init];
Expand Down Expand Up @@ -557,6 +602,15 @@ - (void)returnResults:(NSArray *)results cancelled:(BOOL)cancelled {

[resultArray addObject:dict];
}

if ([result isKindOfClass:[PPDocumentFaceRecognizerResult class]]) {
PPDocumentFaceRecognizerResult *documentFaceResult = (PPDocumentFaceRecognizerResult *)result;

NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
[self setDictionary:dict withDocumentFaceResult:documentFaceResult];

[resultArray addObject:dict];
}
};

if ([resultArray count] > 0) {
Expand Down
5 changes: 5 additions & 0 deletions Release notes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 1.1.4
- update iOS SDK to [v2.6.0](https://github.com/BlinkID/blinkid-ios/releases/tag/v2.6.6)
- added DocumentFace recognizer
- Fixed issues with obtaining images of EUDL and MyKad documents

## 1.1.3
- update Android SDK to [v3.4.1](https://github.com/BlinkID/blinkid-android/releases/tag/v3.4.1)

Expand Down
12 changes: 9 additions & 3 deletions www/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ var app = {

/**
* Use these scanner types
* Available: "PDF417", "USDL", "Bar Decoder", "Zxing", "MRTD", "UKDL", "MyKad"
* Available: "PDF417", "USDL", "Bar Decoder", "Zxing", "MRTD", "EUDL", "UKDL", "DEDL", "MyKad", "DocumentFace"
*/
var types = ["PDF417", "UKDL", "MRTD"];

Expand All @@ -70,7 +70,7 @@ var app = {
// Note that each platform requires its own license key

// This license key allows setting overlay views for this application ID: com.microblink.blinkid
var licenseiOs = "OLJJAUDF-CIV2HMG3-ZFEVNWIC-2FNSXP3W-YLKHF4MV-LTSI5GR7-I5ARBPXV-WRCTMCMT";
var licenseiOs = "SKM5EHOC-2RYRUIEI-E5CT7PZZ-BKMLKJQU-XCIJBEEQ-SCIJBEEQ-SCIJAMA4-CTCG2HA7"; // valid until 2017-05-23

// This license is only valid for package name "com.microblink.blinkid"
var licenseAndroid = "NFRZVYWD-MCK7SSO7-TJ7ZWOC4-AT2AYDM7-JDHZQMHY-V3PZU4SX-54PGUFQM-AUX5RGYJ";
Expand Down Expand Up @@ -161,7 +161,7 @@ var app = {
"Opt1: " + fields[kPPmrtdOpt1] + "; " +
"Opt2: " + fields[kPPmrtdOpt2] + "; ";

} else if (recognizerResult.resultType == "UKDL result") {
} else if (recognizerResult.resultType == "EUDL result") {

var fields = recognizerResult.fields;

Expand All @@ -187,6 +187,12 @@ var app = {
"Full Name: " + fields[kPPmyKadFullName] + "; " +
"Religion: " + fields[kPPmyKadReligion] + "; " +
"Sex: " + fields[kPPmyKadSex] + "; ";

} else if (recognizerResult.resultType == "DocumentFace result") {

var fields = recognizerResult.fields;

resultDiv.innerHTML = "Found document with face";
}
}
},
Expand Down

0 comments on commit 8a60156

Please sign in to comment.