GeneralAccurateOCR

Last updated: 2020-09-17 18:12:02

    1. API Description

    Domain name for API request: ocr.tencentcloudapi.com.

    This API is used to detect and recognize characters in an image. It can recognize Chinese, English, Chinese-English, digits, and special symbols and return the text box positions and characters.

    It is suitable for scenarios with a lot of characters in complex layouts and requiring high recognition accuracy, such as examination papers, online images, signboards, and legal documents.

    Strengths: compared with general print recognition, it provides higher-precision character recognition services. Its accuracy and recall rate are higher in difficult scenarios such as a large number of characters, long strings of digits, small characters, blurry characters, and tilted text.

    This API is not fully available for the time being. For more information, please contact your Tencent Cloud sales rep.

    A maximum of 10 requests can be initiated per second for this API.

    We recommend you to use API Explorer
    Try it
    API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

    2. Input Parameters

    The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

    Parameter Name Required Type Description
    Action Yes String Common parameter. The value used for this API: GeneralAccurateOCR.
    Version Yes String Common parameter. The value used for this API: 2018-11-19.
    Region Yes String Common parameter. For more information, please see the list of regions supported by the product. This API only supports: ap-beijing, ap-guangzhou, ap-hongkong, ap-shanghai, na-toronto
    ImageBase64 No String Base64-encoded value of image.
    The image cannot exceed 7 MB in size after being Base64-encoded. A resolution above 600x800 is recommended. PNG, JPG, JPEG, and BMP formats are supported.
    Either ImageUrl or ImageBase64 of the image must be provided; if both are provided, only ImageUrl will be used.
    ImageUrl No String URL address of image.
    The image cannot exceed 7 MB in size after being Base64-encoded. A resolution above 600x800 is recommended. PNG, JPG, JPEG, and BMP formats are supported.
    We recommend storing the image in Tencent Cloud, as a Tencent Cloud URL can guarantee higher download speed and stability. The download speed and stability of non-Tencent Cloud URLs may be low.

    3. Output Parameters

    Parameter Name Type Description
    TextDetections Array of TextDetection Information on recognized text, including the text line content, confidence, text line coordinates, and text line coordinates after rotation correction. For more information, please click the link on the left.
    Angel Float Image rotation angle in degrees. 0° indicates horizontal text, a positive value indicates clockwise rotation, and a negative value indicates anticlockwise rotation.
    RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

    4. Example

    debugging-tool)">

    Example1 Recognizing general print (high-precision) (debugging tool)

    Input Example

    https://ocr.tencentcloudapi.com/?Action=GeneralAccurateOCR
    &ImageUrl=https://xx/a.jpg
    &<Common request parameters>

    Output Example

    {
      "Response": {
        "TextDetections": [
          {
            "DetectedText": "Confetteria",
            "Confidence": 99,
            "ItemPolygon": {
              "X": 449,
              "Y": 211,
              "Width": 115,
              "Height": 37
            },
            "Polygon": [
              {
                "X": 449,
                "Y": 231
              },
              {
                "X": 452,
                "Y": 211
              },
              {
                "X": 563,
                "Y": 227
              },
              {
                "X": 560,
                "Y": 247
              }
            ],
            "AdvancedInfo": "{\"Parag\":{\"ParagNo\":1}}"
          },
          {
            "DetectedText": "Raffaello",
            "Confidence": 99,
            "ItemPolygon": {
              "X": 361,
              "Y": 242,
              "Width": 288,
              "Height": 97
            },
            "Polygon": [
              {
                "X": 361,
                "Y": 308
              },
              {
                "X": 368,
                "Y": 242
              },
              {
                "X": 648,
                "Y": 271
              },
              {
                "X": 641,
                "Y": 338
              }
            ],
            "AdvancedInfo": "{\"Parag\":{\"ParagNo\":2}}"
          },
          {
            "DetectedText": "Ferrero Rocher Confetteria",
            "Confidence": 99,
            "ItemPolygon": {
              "X": 394,
              "Y": 316,
              "Width": 200,
              "Height": 56
            },
            "Polygon": [
              {
                "X": 394,
                "Y": 349
              },
              {
                "X": 398,
                "Y": 316
              },
              {
                "X": 593,
                "Y": 337
              },
              {
                "X": 589,
                "Y": 371
              }
            ],
            "AdvancedInfo": "{\"Parag\":{\"ParagNo\":2}}"
          },
          {
            "DetectedText": "Raffaello",
            "Confidence": 98,
            "ItemPolygon": {
              "X": 381,
              "Y": 368,
              "Width": 214,
              "Height": 55
            },
            "Polygon": [
              {
                "X": 381,
                "Y": 401
              },
              {
                "X": 385,
                "Y": 368
              },
              {
                "X": 594,
                "Y": 389
              },
              {
                "X": 590,
                "Y": 422
              }
            ],
            "AdvancedInfo": "{\"Parag\":{\"ParagNo\":2}}"
          }
        ],
        "Angel": 0,
        "RequestId": "d2a1c039-817d-455b-b2e2-f765a7261906"
      }
    }

    5. Developer Resources

    API Explorer

    This tool allows online call, signature authentication, SDK code generation and quick search of APIs to greatly improve the efficiency of using TencentCloud APIs.

    SDK

    TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

    Command Line Interface

    6. Error Code

    The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

    Error Code Description
    FailedOperation.DownLoadError File download failed.
    FailedOperation.EmptyImageError The image is empty.
    FailedOperation.EngineRecognizeTimeout Recognition by the engine timed out.
    FailedOperation.ImageBlur The image is blurry.
    FailedOperation.ImageDecodeFailed Image decoding failed.
    FailedOperation.ImageNoText No text is detected in the image.
    FailedOperation.ImageSizeTooLarge The image is too large. Please see the description of image size limit in the output parameters.
    FailedOperation.OcrFailed OCR failed.
    FailedOperation.UnKnowError Unknown error.
    FailedOperation.UnOpenError The service is not activated.
    InvalidParameter.EngineImageDecodeFailed Image decoding failed.
    InvalidParameterValue.InvalidParameterValueLimit Incorrect parameter value.
    LimitExceeded.TooLargeFileError The file is too large.
    ResourcesSoldOut.ChargeStatusException Exceptional billing status.

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback
    Help