Code Recognition

Capability Introduction

Information identification, app integration

This API provides code recognition service, by identifying QR and bar codes, sharing the information in them with the system, and providing service framework based on the information. The service framework can be integrated into a wide range of apps. This API can be used to parse QR codes and bar codes in 11 scenarios, including Wi-Fi and SMS messaging. It provides effective code detection and detection-result-based service capabilities for various programs and apps.
Scenarios

Image parsing, barcode reading

This API parses QR and bar codes in images, and can be applied in diverse scanning scenarios in applications.

Code scanning-based payments

This function is used in mobile services, such as payment app scanning.

Image extraction via code scanning

Code information is extracted when users scan the code, and related services are provided, according to the code recognition results.

Description

Request
Copy

BarcodeDetector detector = new BarcodeDetector(getApplicationContext());
Frame frame = new Frame();
frame.setBitmap(bitmap);
JSONObject jsonObject = detector.detect(frame,null);

Response
Copy

{
    "resultCode": 0,
    "barcode": "[{\"contentTypes\":[11],
 
 
 
    \
    "iSBN\":{\"isbn\":\"9787540746445\"}}]"
}

Start development here with Huawei

Service introduction

Service overview, application scenarios, and functions
Learn more

Access preparation

Preparation for access, such as registration, authentication, and agreement signing
Learn more

Sample code

Demonstration of sample code
Learn more

API description

Interface parameter definition, description, restrictions, and constraints
Learn more
FAQ
1Can I call the faceCompare() method without calling the prepare() method of the API?

Yes, you can. The engine is started by default in the faceCompare() method. If the engine has already been started, it will not restart.

2When should I call the release() method?

The release() method will uninstall a model that has been loaded to the NPU chip. If the app is no longer using face detection, uninstall the model in a timely manner to free up resources.