tencent cloud

文档反馈

LicensePlateOCR

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

    1. API Description

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

    This API is used to recognize a license plate attached to a motor vehicle in the Chinese mainland and return the regional code, license plate number, and license plate color.

    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: LicensePlateOCR.
    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 the image.
    Supported image formats: PNG, JPG, and JPEG. GIF is currently not supported.
    Supported image size: The downloaded image after Base64 encoding can be up to 7 MB. The download time of the image cannot exceed 3s.
    Either ImageUrl or ImageBase64 of the image must be provided. If both are provided, only ImageUrl is used.
    ImageUrl No String The URL of the image.
    Supported image formats: PNG, JPG, and JPEG. GIF is currently not supported.
    Supported image size: The downloaded image after Base64 encoding can be up to 7 MB. 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.
    The download speed and stability of non-Tencent Cloud URLs may be low.

    3. Output Parameters

    Parameter Name Type Description
    Number String The recognized license plate number.
    Confidence Integer The confidence score (0–100).
    Rect Rect The bounding box coordinates of the text line in the original image.
    Color String The recognized license plate color, which currently includes "white", "black", "blue", "green", "yellow", "yellow-green", and "temporary plate".
    LicensePlateInfos Array of LicensePlateInfo The vehicle license plate information.
    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 vehicle license plate

    This example shows you how to recognize a vehicle license plate.

    Input Example

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

    Output Example

    {
        "Response": {
            "Color": "蓝",
            "Confidence": 99,
            "LicensePlateInfos": [
                {
                    "Color": "蓝",
                    "Confidence": 99,
                    "Number": "京AF0236",
                    "Rect": {
                        "Height": 66,
                        "Width": 135,
                        "X": 426,
                        "Y": 423
                    }
                }
            ],
            "Number": "京AF0236",
            "Rect": {
                "Height": 66,
                "Width": 135,
                "X": 426,
                "Y": 423
            },
            "RequestId": "5141467c-0a67-4f7c-b1c5-8147d84681a1"
        }
    }
    

    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.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.