tencent cloud

Feedback

RecognizeMacaoIDCardOCR

Last updated: 2024-11-15 10:53:04

1. API Description

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

This API is used to recognize key fields on the photo side of a Macao (China) identity card, including name in Chinese, name in English, telecode for name, date of birth, gender, document symbol, date of the first issue, date of the last receipt, identity card number, and permanent residency attribute.

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

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: RecognizeMacaoIDCardOCR.
Version Yes String Common Params. The value used for this API: 2018-11-19.
Region No String Common Params. This parameter is not required.
ImageUrl No String The URL address of the image.
Supported image formats: PNG, JPG, JPEG. Not support GIF yet.
Supported image size: The downloaded image should not exceed 7M. The image download takes no more than 3 seconds.Storing images in Tencent Cloud URLs can ensure higher download speed and stability. It is recommended that images be stored in Tencent Cloud. The URL speed and stability of non-Tencent cloud storage may be affected to a certain extent.
BackImageUrl No String The URL address of the image on the back of the card. Supported image formats: PNG, JPG, JPEG. The GIF format is not supported yet. Supported image size: The downloaded image does not exceed 7M after Base64 encoding. The image download takes no more than 3 seconds. Storing images in Tencent Cloud URLs can ensure higher download speed and stability. It is recommended that images be stored in Tencent Cloud. The URL speed and stability of non-Tencent cloud storage may be affected to a certain extent.
ImageBase64 No String Base64 value of the image.Supported image formats: PNG, JPG, JPEG. Not support GIF yet.
Supported image size: The downloaded image should not exceed 7M after Base64 encoding. The image download takes no more than 3 seconds.
One of ImageUrl and ImageBase64 of the image must be provided. If both are provided, only ImageUrl will be used.
BackImageBase64 No String Base64 value of the image on the back of the card. Supported image formats: PNG, JPG, JPEG. The GIF format is not supported yet. Supported image size: The downloaded image does not exceed 7M after Base64 encoding. The image download takes no more than 3 seconds. One of ImageUrl and ImageBase64 of the image must be provided. If both are provided, only ImageUrl will be used.
Config No String The following optional fields are of string type and are empty by default:
RetImage: whether to return the processed image (base64 encrypted string); the value and meaning of RetImage are as follows: 1.portrait Return portrait image data 2."" Do not return image data SDK setting method reference: Config = Json.stringify({"RetImage":"portrait"}) API 3.0 Explorer setting method reference: Config = {"RetImage":"portrait" }

3. Output Parameters

Parameter Name Type Description
CnLastName String Chinese last name
EnLastName String English last name
LastNameCode String Last name code
CnFirstName String Chinese first name
EnFirstName String English first name
FirstNameCode String First name code
ID String ID Number
Birthday String Birthday(DD-MM-YYYY)
Sex String gender
FirstIssueDate String First issue Date (DD-MM-YYYY)
CurrentIssueDate String Issue date (DD-MM-YYYY)
ValidityPeriod String Validity period (DD-MM-YYYY)
Symbol String ID symbol
Height String Height (unit: meters)
RetImage String Processed image (Base64)
Angle String Image rotation angle, the horizontal direction of the text is 0, clockwise is positive, counterclockwise is negative
ResidentType String Resident type.
WarnCardInfos Array of Integer Card Warning Information

-9101 Alarm for covered certificate,
-9102 Alarm for photocopied certificate,
-9103 Alarm for photographed certificate,
-9104 Alarm for PS 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 Recognizes Macao (China) identity card

Recognizes Macao (China) identity card

Input Example

    
https://ocr.intl.tencentcloudapi.com/?Action=RecognizeMacaoIDCardOCR
&ImageUrl=https://xx/a.jpg
&Config={\"RetImage\":\"preprocess\"}
&<public parameters>

Output Example

{
    "Response": {
        "Angle": "0",
        "CnLastName": "",
        "EnLastName": "HO",
        "LastNameCode": "0149",
        "CnFirstName": "*",
        "EnFirstName": "CHAN YOU",
        "FirstNameCode": "37****27",
        "ID": "15****0(4)",
        "Birthday": "22-04-1997",
        "Sex": "F",
        "FirstIssueDate": "06-05-2011",
        "CurrentIssueDate": "01-08-2014",
        "ValidityPeriod": "01-08-2024",
        "Symbol": "C",
        "Height": "1.64",
        "RetImage": "",
        "RequestId": "68f8fcbf-9314-6112a-ac18-6f1a9308fs100mab"
    }
}

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.ImageDecodeFailed Image decoding failed.
FailedOperation.OcrFailed OCR failed.
FailedOperation.UnKnowError Unknown error.
FailedOperation.UnOpenError The service is not activated.
FailedOperation.WarningServiceFailed
InvalidParameter.ConfigFormatError Config is not in valid JSON format.
InvalidParameterValue.InvalidParameterValueLimit Incorrect parameter value.
LimitExceeded.TooLargeFileError The file is too large.