tencent cloud

文档反馈

最后更新时间:2024-03-06 15:47:42

    1. API Description

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

    This API is used to recognize various types of seals, including invoice seals and finance seals. It is suitable for scenarios such as official document and invoice/ticket OCR.

    A maximum of 5 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 Params. The value used for this API: SealOCR.
    Version Yes String Common Params. The value used for this API: 2018-11-19.
    Region No String Common Params. This parameter is not required for this API.
    ImageBase64 No String The Base64-encoded value of an image. The image cannot exceed 7 MB after being Base64-encoded. A resolution above 500 x 800 is recommended. PNG, JPG, JPEG, and BMP formats are supported. It is recommended that the card part occupy more than 2/3 area of the image.
    Either ImageUrl or ImageBase64 of the image must be provided. If both are provided, ImageUrl is used.
    ImageUrl No String The URL of the image. The image cannot exceed 7 MB after being Base64-encoded. A resolution above 500 x 800 is recommended. PNG, JPG, JPEG, and BMP formats are supported. It is recommended that the card part occupy more than 2/3 area of the image. The download time of the image cannot exceed 3s.
    We recommend that you store the image in Tencent Cloud for higher download speed and stability.

    3. Output Parameters

    Parameter Name Type Description
    SealBody String Seal content
    Location Rect Seal coordinates
    OtherTexts Array of String Other text content
    SealInfos Array of SealInfo All seal information
    SealShape String Seal shape. Valid values:
    0: Round
    1: Oval
    2: Rectangle
    3: Diamond
    4: Triangle
    RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

    4. Example

    Example1 Recognizing a seal

    This example shows you how to recognize a seal.

    Input Example

    POST / HTTP/1.1
    Host: ocr.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: SealOCR
    <Common request parameters>
    
    {
        "ImageUrl": "https://ocr-demo-1254418846.cos.ap-guangzhou.myqcloud.com/document/SealOCR/SealOCR1.png"
    }
    

    Output Example

    {
        "Response": {
            "Location": {
                "Height": 98,
                "Width": 98,
                "X": 143,
                "Y": 78
            },
            "OtherTexts": [],
            "RequestId": "442c7c51-9893-4411-9ba0-69747e5424d2",
            "SealBody": "上海市宝山区市场监督管理局",
            "SealInfos": [
                {
                    "Location": {
                        "Height": 98,
                        "Width": 98,
                        "X": 143,
                        "Y": 78
                    },
                    "OtherTexts": [],
                    "SealBody": "上海市宝山区市场监督管理局",
                    "SealShape": "0"
                }
            ],
            "SealShape": "0"
        }
    }
    

    5. Developer Resources

    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.ImageDecodeFailed Image decoding failed.
    FailedOperation.ImageNoText No text is detected in the image.
    FailedOperation.OcrFailed OCR failed.
    FailedOperation.UnKnowError Unknown error.
    FailedOperation.UnOpenError The service is not activated.
    InvalidParameterValue.InvalidParameterValueLimit Incorrect parameter value.
    LimitExceeded.TooLargeFileError The file is too large.
    ResourceUnavailable.InArrears
    ResourceUnavailable.ResourcePackageRunOut
    ResourcesSoldOut.ChargeStatusException Exceptional billing status.
    联系我们

    联系我们,为您的业务提供专属服务。

    技术支持

    如果你想寻求进一步的帮助,通过工单与我们进行联络。我们提供7x24的工单服务。

    7x24 电话支持