-
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.
[android] updated bindings for v4.9.0
- Loading branch information
Showing
7 changed files
with
54 additions
and
2 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
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