What Is OCR?

Optical Character Recognition (OCR) detects and extracts text from images and converts the recognition results into an editable JSON format.

OCR provides open APIs, so you can use programming languages such as Python and Java to call OCR APIs to extract text from images. OCR allows you to automate the collection of key data. It helps you build an intelligent service system to improve efficiency. For details about how to obtain APIs, see Optical Character Recognition API Reference.

OCR also provides software development kits (SDKs) for multiple programming languages. For details about how to use SDKs, see the Optical Character Recognition SDK Reference.

Before You Start

You will need some basic programming skills. Familiarity with Java, Python, iOS, Android, and Node.js is recommended.

You need to call APIs to use OCR and transmit the results to the service system, or to convert the results from JSON to TXT or Excel form.

OCR Capabilities

General OCR

Text in images (including web images and more) can be automatically identified.

Card OCR

OCR automatically identifies information in images of certificates such as passports, ID cards, and driving licenses, and converts the information into editable text.

Using OCR for the First Time

If you are a first-time user, the following sections are a good place to start:

Function Description

Learn about the different OCR functions, including General OCR and Card OCR.

Getting Started

Learn how to use OCR by referring to Optical Character Recognition Getting Started.

Using OCR

Learn how to call OCR services as a developer who feel more comfortable writing code, see Optical Character Recognition API Reference or Optical Character Recognition SDK Reference.

Progressive Knowledge

Learn how to get started using OCR.

OCR Activities & Promotions Activities

Free Packages

Detect and extract text from images and convert it into an editable JSON format.

Hot
Try Free
Huawei Cloud Blossom Program

Help your business bloom with cloud resource discounts, free trainings, and collaborative marketing opportunities

Hot
Try Now

OCR FAQs

Token-based Authentication, Billing, Subscription

  • What Are the Username, Domain Name, and Project Name in the Token Message Body?

    Username indicates the name of the user, and Domain Name indicates the name of the account to which the user belongs. If the token is obtained by an account, the username and domain name are the same. If the token is obtained by an IAM user (multiple IAM users can be created under an account), the username is a real-world username and is different from the domain name.

  • Why Is Status Code 401 Returned After a Token Is Obtained?

    If status code 401 is returned when OCR is called in token mode, the token has expired. The validity period of a token is 24 hours. You are advised to obtain a new token to call the OCR API.

    The retry mechanism has been configured in the OCR SDK to update the token. If the token is invalid and status code 401 is returned, the OCR SDK sends a request to obtain a token again.

    For details about how to use the Python programming language to obtain a token again when the existing one has expired, see the HWOcrClientToken.py code in the SDK(Python) file, as shown in the following figure.

  • How Do I Unsubscribe from an OCR Service?

    If you no longer need to use an OCR service after you subscribe to it, you can unsubscribe it from the OCR console.

  • What Do I Do If the Subscribe Button Is Dimmed?

    Symptom

    After logging in to the OCR console, I cannot subscribe to an OCR service because the Subscribe button is dimmed.

    Possible Causes

    The possible cause is that the current user is an IAM user who does not have the permission to subscribe to the service. An account pays for and owns the resources and has full access permissions for the resources.

    Solution

    Log in to the OCR console using an account and subscribe to OCR.

  • How Do I Select a Region for an OCR Package?

    Resource packages in different regions are isolated. Select a region according to your business requirements. For details about the regions where services are deployed, see Endpoints.

    Determine the service region before purchasing a service package.

  • Can a Package Be Refunded After Being Purchased?

    The package cannot be refunded after being purchased.

  • How Does a Member Account Use a Package Purchased by an Enterprise Master Account?

    The enterprise master account and its member accounts are accurately named the account and the IAM users. The account pays for and owns the resources and has full access permissions for these resources. IAM users are created by the account, and only have the permissions granted by the account. The account can modify or cancel the IAM users' permissions at any time. Fees generated by IAM users are paid by the account. An account can be used to create IAM users and assign permissions to the IAM users. IAM users can view and use the resources authorized by the account after logging in to the system.