tencent cloud

文档反馈

RecognizeThaiIDCardOCR

最后更新时间:2024-06-13 18:17:16

    1. API Description

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

    This API is used to recognize the fields on a Thai identity card, including name in Thai, name in English, address, date of birth, identification number, date of issue, and date of expiry.
    Currently, this API is not generally available. For more information, please contact your 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 Params. The value used for this API: RecognizeThaiIDCardOCR.
    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.
    We recommend that you store the image in Tencent Cloud for higher download speed and stability.
    CropPortrait No Boolean Whether to crop the profile photo. The default value is false, meaning not to return the Base64-encoded value of the profile photo on the Thai identity card.
    When this parameter is set to true, the Base64-encoded value of the profile photo on the Thai identity card after rotation correction is returned.

    3. Output Parameters

    Parameter Name Type Description
    ID String ID card number
    ThaiName String Name in Thai
    EnFirstName String Name in English
    EnLastName String Name in English
    IssueDate String Date of issue in Thai
    ExpirationDate String Expiration date in Thai
    EnIssueDate String Date of issue in English
    EnExpirationDate String Expiration date in English
    Birthday String Date of birth in Thai
    EnBirthday String Date of birth in English
    Religion String Religion
    SerialNumber String Serial number
    Address String Address
    PortraitImage String Identity photo
    WarnCardInfos Array of Integer Card Warning Information

    -9101 Alarm for covered certificate,
    -9102 Alarm for photocopied certificate,
    -9103 Alarm for photographed certificate,
    -9107 Alarm for reflective certificate,
    -9108 Alarm for blurry image,
    -9109 This capability is not enabled.
    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 Thai identity card

    This example shows you how to recognize a Thai identity card.

    Input Example

    POST / HTTP/1.1
    Host: ocr.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: RecognizeThaiIDCardOCR
    <Common request parameters>
    
    {
        "ImageUrl": "https://xx/a.jpg"
    }
    

    Output Example

    {
        "Response": {
            "ID": "3102001968756",
            "ThaiName": "[ThaiName in thai]",
            "EnFirstName": "Mr. Thanakit",
            "Address": "Boonyopakron",
            "Birthday": "[Birthday in thai]",
            "IssueDate": "[IssueDate in thai]",
            "ExpirationDate": "[ExpirationDate in thai]",
            "EnLastName": "Boonyopakron",
            "PortraitImage": "oiuu",
            "RequestId": "98f8fcbf-933a-4e95-ac48-6f1a9308fs51"
        }
    }
    

    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.EmptyImageError The image is empty.
    FailedOperation.ImageBlur The image is blurry.
    FailedOperation.ImageDecodeFailed Image decoding failed.
    FailedOperation.ImageNoSpecifiedCard The card in the image is not of the specified type.
    FailedOperation.OcrFailed OCR failed.
    FailedOperation.UnKnowError Unknown error.
    FailedOperation.UnOpenError The service is not activated.
    FailedOperation.WarningServiceFailed
    InvalidParameterValue.InvalidParameterValueLimit Incorrect parameter value.
    LimitExceeded.TooLargeFileError The file is too large.
    ResourcesSoldOut.ChargeStatusException Exceptional billing status.