OCR for general handwriting recognition

更新时间:
复制 MD 格式

1. Component introduction

Note

Required preceding components: None

Recommended succeeding components: Conditional Branch. Use branch conditions to check whether the OCR call is successful and to design the subsequent flow.

This component uses Optical Character Recognition (OCR) technology to recognize unstructured text in images from various industry scenarios (Example).

2. Inputs

Note

For more information about each input, see the help text in the component panel of the ROS Visual Editor.

3. Outputs

Note

For more information about each output, see the help text in the component panel of the ROS Visual Editor.

3.1. Key API return results

This output returns a dictionary that contains the key recognition results from the API. The following table describes the key-value pairs.

Key

Key terms

Data type

content

A collection of recognized text blocks from the image.

String

3.2. Error message

This output returns the error code and error message as a string. For more information, see the OCR Error Center.

https://next.api.aliyun.com/document/ocr-api/2021-07-07/errorCode

4. Component usage example

4.1. Configuration example

  1. Set the AI engine to Alibaba Cloud OCR.

  2. For Path of the image file to be recognized, enter the path to the image file. This example uses the following image.

    image

  3. Keep the default values for the advanced options.

4.2. Example execution result

image

5. Flow example

5.1. Build the flow

  1. Use the OCR for general handwriting recognition component and select the path of the image file.

  2. Use the Conditional Branch component to check whether the OCR call succeeded. For the condition, check whether `v_recognize_handWriting_success_1` is equal to the Boolean value `True`.

  3. In the success branch, use the Get value of specified key component to retrieve a specific key from the dictionary of key API return results.

  4. Use the Record Log component to print the key recognition result.

  5. In the failure branch, use the Record Log component to print the error message. image

5.2. Execution result

After the OCR call succeeds, the recognition result is printed in the log panel, as shown in the following figure.