General Text Recognition

Capability Introduction

Text detection, automatic extraction

The snapshot OCR API is applicable for image data from multiple sources including camera and image library. It provides an open interface for automatic detection and identification of the text location and content in images. The screenshot OCR API is for handling screenshot on smartphones, providing diverse handy on-device services such as copying, editing, word segmentation, and semantic analysis.
Scenarios

Information extraction, copying and searching

"Snapshot OCR: Detects and identifies image data from various sources, such as Camera and Gallery, and is relevant for photography and information extraction, such as detecting text in a PPT snapshot, and text content recognition. Screenshot OCR: extracts screenshots on devices, and can be applied in copying, editing, word segmentation, semantic analysis, and keyword-based searches."

Text information processing

Text in phone screenshots is extracted for further processing, useful for editing, copying, word segmentation, and semantic analysis.

Keyword-based image searching

Phone screenshots can be searched by keyword.

Description

Request
Copy

TextDetector textDetector = new TextDetector( this);
Frame frame = new Frame();
frame.setBitmap(bitmap);
JSONObject jsonResult = textDetector.detect(frame, null);

Response
Copy

{
    "resultCode": 0,
    "common_text": "{\"blocks\":
 
 
 
    [{\
               "boundingBox\":{\"height\":
 
 
 
              33,
              \"left\":592,\"top\":857,\"width\":140},
 
 
 
              \
             "cornerPoints\":[{\"x\":592,\"y\":857},
 
 
 
            {\
                 "x\":732,\"y\":857},{\"x\":592,\"y\":890},
 
 
 
                 {\
                 "x\":732,\"y\":890}],
 
 
 
                 \
                "probability\":0.77,\"value\":\"返程日期\"},
 
 
 
                {\
                "boundingBox\":
 
 
 
               {\
               "height\":33,\"left\":650,\"top\":924,\"width\":141},
 
 
 
               \
              "cornerPoints\":[{\"x\":650,\"y\":924},
 
 
 
              {\
              "x\":791,\"y\":924},{\"x\":650,
 
 
 
             \
             "y\":957},{\"x\":791,\"y\":957}],
 
 
 
            \
           "probability\":0.75,\"value\":\"添加返程\"},
 
 
 
          {\
          "boundingBox\":
 
 
 
         {\
         "height\":45,\"left\":430,\"top\":1938,\"width\":232},
 
 
 
         \
         "cornerPoints\":
 
 
 
         [{\
         "x\":430,\"y\":1938},{\"x\":662,\"y\":1938},
 
 
 
         {\
         "x\":430,\"y\":1983},{\"x\":662,\"y\":1983}],
 
 
 
         \
         "probability\":0.7,\"value\":\"国 我的订单\"},
 
 
 
         {\
         "boundingBox\":
 
 
 
         {\
         "height\":46,\"left\":757,\"top\":2077,\"width\":46},
 
 
 
         \
         "cornerPoints\":
 
 
 
         [{\
         "x\":757,\"y\":2077},{\"x\":803,\"y\":2077},
 
 
 
         {\
         "x\":757,\"y\":2123},{\"x\":803,\"y\":2123}],
 
 
 
         \
         "probability\":0.72,\"value\":\"口\"}],
 
 
 
         \
         "cornerPoints\":[{\"x\":430,\"y\":857},
 
 
 
         {\
         "x\":803,\"y\":857},{\"x\":430,\"y\":2123},
 
 
 
         {\
         "x\":803,\"y\":2123}],\"probability\":0.735,
 
 
 
         \
         "textRect\":{\"height\":1266,\"left\":430,
 
 
 
         \
         "top\":857,\"width\":373},\"value\":
 
 
 
         \
    "返程日期\\n添加返程\\n国 我的订单\\n口\"}"
}

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 prepare() method directly use detect() method without calling the API?

Yes. In detect() method engine startup is in default. The engine will not start up again if started, please use with confidence.

2What languages are currently supported by the OCR API?

The screenshot OCR currently supports both Chinese and English. The snapshot OCR supports Chinese, English, German, French, Italian, Spanish, and Portuguese. In the near future, the snapshot OCR will be made available in Japanese, Korean, and Russian. For details about future dates of availability, please refer to related development documents.