tencent cloud

文档反馈

DetectReflectLivenessAndCompare

最后更新时间:2024-04-03 11:45:35

    1. API Description

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

    This API is used to detect liveness with the package generated by the liveness comparison (reflection-based) SDK, and to compare the person detected with that in the image passed in.
    The image and the data generated with the SDK must be stored in COS, and the region of the COS bucket must be same as that of requests made with this API. We recommend that you pass resources with upload link APIs.

    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: DetectReflectLivenessAndCompare.
    Version Yes String Common Params. The value used for this API: 2018-03-01.
    Region Yes String Common Params. For more information, please see the list of regions supported by the product. This API only supports: ap-bangkok, ap-hongkong, ap-singapore.
    LiveDataUrl Yes String URL of the liveness detection data package generated by the SDK
    LiveDataMd5 Yes String MD5 hash value (32-bit) of the liveness detection data package generated by the SDK, which is used to verify the LiveData consistency.
    ImageUrl Yes String URL of the target image for comparison
    ImageMd5 Yes String MD5 hash value (32-bit) of the target image for comparison, which is used to verify the Image consistency.

    3. Output Parameters

    Parameter Name Type Description
    BestFrameUrl String Temporary URL of the best screenshot (.jpg) of the video after successful verification. Both the screenshot and the URL are valid for two hours only, so you need to download the screenshot within this period.
    BestFrameMd5 String MD5 hash value (32-bit) of the best screenshot of the video after successful verification, which is used to verify the BestFrame consistency.
    Result String Service error code. Success will be returned for success. For error information, see the FailedOperation section in the error code list below.
    Description String Service result description
    Sim Float Similarity. Value range: [0.00, 100.00]. As a recommendation, when the similarity is greater than or equal to 70, it can be determined that the two faces are of the same person. You can adjust the threshold according to your specific scenario (the FAR at the threshold of 70 is 0.1%, and FAR at the threshold of 80 is 0.01%).
    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 Compared successfully

    Input Example

    POST / HTTP/1.1
    Host: faceid.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: DetectReflectLivenessAndCompare
    <Common request parameters>
    
    {
        "ImageMd5": "d41d8cd98f00b204e9800998ecf8427e",
        "LiveDataUrl": "https://faceid-resource-sg-1254418846.cos.ap-singapore.myqcloud.com/faceid%2FApplyWebVerificationToken%2F1300268875%2F20b11b59-572d-406d-8d94-e6e05782134c",
        "ImageUrl": "https://faceid-resource-sg-1254418846.cos.ap-singapore.myqcloud.com/faceid%2FApplyWebVerificationToken%2F1300268875%2F20b11b59-572d-406d-8d94-e6e05782134c",
        "LiveDataMd5": "d41d8cd98f00b204e9800998ecf8427e"
    }
    

    Output Example

    {
        "Response": {
            "BestFrameUrl": "https://faceid-resource-sg-1254418846.cos.ap-singapore.myqcloud.com/faceid%2FApplyWebVerificationToken%2F1300268875%2F20b11b59-572d-406d-8d94-e6e05782134c",
            "Description": "Success",
            "BestFrameMd5": "d41d8cd98f00b204e9800998ecf8427e",
            "RequestId": "00577fa0-9d11-459e-a455-fc202ecd65bc",
            "Sim": 96.3,
            "Result": "Success"
        }
    }
    

    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.ActionLightDark The lighting is too dim.
    FailedOperation.ActionLightStrong The lighting is too strong.
    FailedOperation.DownLoadError File download failed.
    FailedOperation.DownLoadTimeoutError File download timed out.
    FailedOperation.ImageBlur The image is blurry.
    FailedOperation.ImageDecodeFailed Image decoding failed.
    FailedOperation.ImageSizeTooLarge The image is too large.
    FailedOperation.LifePhotoDetectFake Real person comparison failed.
    FailedOperation.LifePhotoSizeError The image passed in is too large or too small.
    FailedOperation.LivessDetectFail Liveness detection failed.
    FailedOperation.LivessDetectFake Suspected spoofed recording.
    FailedOperation.LivessSystemError Error calling the liveness engine API.
    FailedOperation.LivessUnknownError Video-based real person detection failed.
    FailedOperation.SilentDetectFail Real person detection failed.
    FailedOperation.SilentFaceDetectFail No face is detected in the video.
    FailedOperation.SilentFaceQualityFail Low face quality.
    FailedOperation.SilentMultiFaceFail Multiple faces are detected in the video.
    FailedOperation.SilentPictureLiveFail The video might be spoofed.
    FailedOperation.SilentThreshold Real person detection did not reach the passing standard.
    InternalError.ActionLightDark The lighting is too dim.
    InternalError.ActionLightStrong The lighting is too strong.
    InternalError.ActionNodetectFace Failed to detect a full face.
    InternalError.CompareLowSimilarity The similarity did not reach the passing standard.
    InternalError.LifePhotoPoorQuality The resolution of the image passed in is too low. Please upload a new one.
    InternalError.LifePhotoSizeError The image passed in is too large or too small.