Updated on 2023-10-26 GMT+08:00

Interpreting Recognition Results

Use the Web Image OCR API as an example to walk you through how to interpret the recognition results in JSON format returned by the API. For details, see "Response Parameters" in Optical Character Recognition API Reference.

The following figure is used as an example to describe the mapping between the image content and the fields returned by the API.

Figure 1 Web image

After the Web Image OCR API is called successfully, the result field is displayed in returned JSON result. This field contains information such as the number of text blocks, text block sequence, text content, location, and confidence.

  • The result field is returned only after the API is successfully called.
  • words_block_count: Number of text blocks. In this example, two text blocks are extracted, indicating two lines of text in the image.
  • words_block_list: List of text blocks arranged from top to bottom according to the position of text in the image from top to bottom and from left to right.
  • words: Recognized text content; confidence: confidence of the field.
  • location: Location of a text block in the image coordinate system. The vertex of the upper left corner of the first text block is [184,606].
  • extracted_data: Width and height in the image. This field is returned only when the extract_type input parameter is set.
    {
     "result": {
      "words_block_list": [
       {
        "words": "School",
        "confidence": 0.891,
        "location": [
         [
          184,
          606
         ],
         [
          461,
          608
         ],
         [
          461,
          684
         ],
         [
          184,
          682
         ]
        ]
       },
       {
        "words": "Children going to or from school",
        "confidence": 0.9115,
        "location": [
         [
          85,
          779
         ],
         [
          554,
          778
         ],
         [
          554,
          820
         ],
         [
          85,
          821
         ]
        ]
       }
      ],
      "words_block_count": 2,
      "extracted_data": {}
     }
    }