-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #105 from BlinkID/release/v4.9.0
Release/v4.9.0
- Loading branch information
Showing
16 changed files
with
251 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...honegap/plugins/microblink/recognizers/serialization/PassportRecognizerSerialization.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.phonegap.plugins.microblink.recognizers.serialization; | ||
|
||
import com.microblink.entities.recognizers.Recognizer; | ||
import com.phonegap.plugins.microblink.recognizers.RecognizerSerialization; | ||
|
||
import org.json.JSONException; | ||
import org.json.JSONObject; | ||
|
||
public final class PassportRecognizerSerialization implements RecognizerSerialization { | ||
|
||
@Override | ||
public Recognizer<?, ?> createRecognizer(JSONObject jsonRecognizer) { | ||
com.microblink.entities.recognizers.blinkid.passport.PassportRecognizer recognizer = new com.microblink.entities.recognizers.blinkid.passport.PassportRecognizer(); | ||
recognizer.setDetectGlare(jsonRecognizer.optBoolean("detectGlare", true)); | ||
recognizer.setFaceImageDpi(jsonRecognizer.optInt("faceImageDpi", 250)); | ||
recognizer.setFullDocumentImageDpi(jsonRecognizer.optInt("fullDocumentImageDpi", 250)); | ||
recognizer.setFullDocumentImageExtensionFactors(BlinkIDSerializationUtils.deserializeExtensionFactors(jsonRecognizer.optJSONObject("fullDocumentImageExtensionFactors"))); | ||
recognizer.setReturnFaceImage(jsonRecognizer.optBoolean("returnFaceImage", false)); | ||
recognizer.setReturnFullDocumentImage(jsonRecognizer.optBoolean("returnFullDocumentImage", false)); | ||
return recognizer; | ||
} | ||
|
||
@Override | ||
public JSONObject serializeResult(Recognizer<?, ?> recognizer) { | ||
com.microblink.entities.recognizers.blinkid.passport.PassportRecognizer.Result result = ((com.microblink.entities.recognizers.blinkid.passport.PassportRecognizer)recognizer).getResult(); | ||
JSONObject jsonResult = new JSONObject(); | ||
try { | ||
SerializationUtils.addCommonResultData(jsonResult, result); | ||
jsonResult.put("faceImage", SerializationUtils.encodeImageBase64(result.getFaceImage())); | ||
jsonResult.put("fullDocumentImage", SerializationUtils.encodeImageBase64(result.getFullDocumentImage())); | ||
jsonResult.put("mrzResult", BlinkIDSerializationUtils.serializeMrzResult(result.getMrzResult())); | ||
} catch (JSONException e) { | ||
// see https://developer.android.com/reference/org/json/JSONException | ||
throw new RuntimeException(e); | ||
} | ||
return jsonResult; | ||
} | ||
|
||
@Override | ||
public String getJsonName() { | ||
return "PassportRecognizer"; | ||
} | ||
|
||
@Override | ||
public Class<?> getRecognizerClass() { | ||
return com.microblink.entities.recognizers.blinkid.passport.PassportRecognizer.class; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
BlinkID/src/ios/sources/Recognizers/Wrappers/MBPassportRecognizerWrapper.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#import "MBRecognizerWrapper.h" | ||
#import <MicroBlink/MicroBlink.h> | ||
|
||
@interface MBPassportRecognizerCreator : NSObject<MBRecognizerCreator> | ||
|
||
@end |
75 changes: 75 additions & 0 deletions
75
BlinkID/src/ios/sources/Recognizers/Wrappers/MBPassportRecognizerWrapper.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#import "MBPassportRecognizerWrapper.h" | ||
#import "MBSerializationUtils.h" | ||
#import "MBBlinkIDSerializationUtils.h" | ||
|
||
@implementation MBPassportRecognizerCreator | ||
|
||
@synthesize jsonName = _jsonName; | ||
|
||
-(instancetype) init { | ||
self = [super init]; | ||
if (self) { | ||
_jsonName = @"PassportRecognizer"; | ||
} | ||
return self; | ||
} | ||
|
||
-(MBRecognizer *) createRecognizer:(NSDictionary*) jsonRecognizer { | ||
MBPassportRecognizer *recognizer = [[MBPassportRecognizer alloc] init]; | ||
{ | ||
id detectGlare = [jsonRecognizer valueForKey:@"detectGlare"]; | ||
if (detectGlare != nil) { | ||
recognizer.detectGlare = [(NSNumber *)detectGlare boolValue]; | ||
} | ||
} | ||
{ | ||
id faceImageDpi = [jsonRecognizer valueForKey:@"faceImageDpi"]; | ||
if (faceImageDpi != nil) { | ||
recognizer.faceImageDpi = [(NSNumber *)faceImageDpi unsignedIntegerValue]; | ||
} | ||
} | ||
{ | ||
id fullDocumentImageDpi = [jsonRecognizer valueForKey:@"fullDocumentImageDpi"]; | ||
if (fullDocumentImageDpi != nil) { | ||
recognizer.fullDocumentImageDpi = [(NSNumber *)fullDocumentImageDpi unsignedIntegerValue]; | ||
} | ||
} | ||
{ | ||
id fullDocumentImageExtensionFactors = [jsonRecognizer valueForKey:@"fullDocumentImageExtensionFactors"]; | ||
if (fullDocumentImageExtensionFactors != nil) { | ||
recognizer.fullDocumentImageExtensionFactors = [MBBlinkIDSerializationUtils deserializeMBImageExtensionFactors:(NSDictionary*)fullDocumentImageExtensionFactors]; | ||
} | ||
} | ||
{ | ||
id returnFaceImage = [jsonRecognizer valueForKey:@"returnFaceImage"]; | ||
if (returnFaceImage != nil) { | ||
recognizer.returnFaceImage = [(NSNumber *)returnFaceImage boolValue]; | ||
} | ||
} | ||
{ | ||
id returnFullDocumentImage = [jsonRecognizer valueForKey:@"returnFullDocumentImage"]; | ||
if (returnFullDocumentImage != nil) { | ||
recognizer.returnFullDocumentImage = [(NSNumber *)returnFullDocumentImage boolValue]; | ||
} | ||
} | ||
|
||
return recognizer; | ||
} | ||
|
||
@end | ||
|
||
@interface MBPassportRecognizer (JsonSerialization) | ||
@end | ||
|
||
@implementation MBPassportRecognizer (JsonSerialization) | ||
|
||
-(NSDictionary *) serializeResult { | ||
NSMutableDictionary* jsonResult = (NSMutableDictionary*)[super serializeResult]; | ||
[jsonResult setValue:[MBSerializationUtils encodeMBImage:self.result.faceImage] forKey:@"faceImage"]; | ||
[jsonResult setValue:[MBSerializationUtils encodeMBImage:self.result.fullDocumentImage] forKey:@"fullDocumentImage"]; | ||
[jsonResult setValue:[MBBlinkIDSerializationUtils serializeMrzResult:self.result.mrzResult] forKey:@"mrzResult"]; | ||
|
||
return jsonResult; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters