| class info |
| com.huawei.hms.mlsdk.card.icr.cloud.MLRemoteIcrAnalyzer |
On-cloud ID card (second-generation ID card of Chinese mainland residents) recognition analyzer, which is used to recognize ID card information in the supplied image, and call the on-cloud API (the detection model runs on the cloud).You can create an on-cloud ID card recognition analyzer in either of the following ways based on the site requirements: // Method 1: Use default parameter settings. MLRemoteIcrAnalyzer analyzer = MLCardAnalyzerFactory.getInstance().getRemoteIcrAnalyzer(); // Method 2: Use customized parameter settings. MLRemoteIcrAnalyzer analyzer = MLCardAnalyzerFactory.getInstance().getRemoteIcrAnalyzer(setting); |
- // Method 1: Use default parameter settings.
- MLRemoteIcrAnalyzer analyzer = MLCardAnalyzerFactory.getInstance().getRemoteIcrAnalyzer();
- // Method 2: Use customized parameter settings.
- // setsetSideTyperont or back side of an ID card.
- // MLRMLRemoteIcrAnalyzerSetting.FRONThe value is FROFRONTndicating the front side.
- // MLRMLRemoteIcrAnalyzerSetting.BACKhe value is BACBACKndicating the back side.
- MLRemoteIcrAnalyzerSetting settings = new MLRemoteIcrAnalyzerSetting.Factory()
- .setSideType(MLRemoteIcrAnalyzerSetting.FRONT)
- .create();
- MLRemoteIcrAnalyzer analyzer = MLCardAnalyzerFactory.getInstance().getRemoteIcrAnalyzer(settings);
- // Construct MLFMLFrame using the bitmap.It is recommended that the image size be greater than or equal to 512 x 512.
- MLFrame mlFrame = new MLFrame.Creator().setBitmap(bitmap).create();
- // Recognize information from an ID card.
- Tasktask = analyzer.asyncAnalyseFrame(mlFrame);
- task.addOnSuccessListener(new OnSuccessListener() {
- public void onSuccess(MLIdCard idCard) {
- // Processing logic for recognition success.
- }})
- .addOnFailureListener(new OnFailureListener() {
- public void onFailure(Exception e) {
- // Processing logic for failure.
- }});
| Return type | Method name |
| com.huawei.hmf.tasks.Task<MLIdCard> | asyncAnalyseFrame(final MLFrame frame) |
| void | stop() |
| MLRemoteIcrAnalyzer | create(MLApplication app, mlsdk.card.icr.cloud.MLRemoteIcrAnalyzerSetting setting) |
| Method |
| public com.huawei.hmf.tasks.Task<MLIdCard> asyncAnalyseFrame(final MLFrame frame) |
| Recognizes ID card information in a supplied image. |
Parameters
| Parameter name | Parameter desc |
| frame | Image object to be recognized, which can be a bitmap. |
Return
| Type | desc |
| com.huawei.hmf.tasks.Task<MLIdCard> | Returns the asynchronous task object. |
| Method |
| public void stop() |
| Releases resources, including input and output streams. |
| Method |
| public static synchronized MLRemoteIcrAnalyzer create(MLApplication app, MLRemoteIcrAnalyzerSetting setting) |
| Creates an on-cloud ID card recognition analyzer object. |
Parameters
| Parameter name | Parameter desc |
| app | MLApplication instance. |
| setting | ID card recognition configurator instance. |
Return
| Type | desc |
| MLRemoteIcrAnalyzer | Returns an on-cloud ID card recognition analyzer object. |