This article describes the overall access process of liveness face comparison in API mode. You can integrate it using any language you are familiar with because this API is language independent. However, before using API to integrate liveness face comparison services, you'd better be able to read and understand Connecting to Tencent Cloud API, which tells you how to use Tencent Cloud SDK to simplify the API access process. In this article, we only demonstrate how to integrate our APIs using Java API SDK. Preparing for Access
Register a Tencent Cloud enterprise account. Refer to Signing Up. Introducing Tencent Cloud API SDK
<dependency>
<groupId>com.tencentcloudapi</groupId>
<artifactId>tencentcloud-sdk-java-intl-en</artifactId>
<version>3.0.798</version>
</dependency>
Initializing and Configuring API SDK Client
Credential cred = new Credential("secretId", "secretKey");
ClientProfile clientProfile = new ClientProfile();
clientProfile.setSignMethod(ClientProfile.SIGN_TC3_256);
FaceidClient client = new FaceidClient(cred, "ap-singapore", clientProfile);
Calling the CompareFaceLiveness API
CompareFaceLivenessRequest request = new CompareFaceLivenessRequest();
request.setLivenessType("SILENT");
request.setImageBase64(getBase64(cmd.getOptionValue(IMAGE_PATH)));
request.setVideoBase64(getBase64(cmd.getOptionValue(VIDEO_PATH)));
CompareFaceLivenessResponse response = client.CompareFaceLiveness(request);
System.out.println(CompareFaceLivenessResponse.toJsonString(response));
Usage Example
You can view full sample source code at GitHub repository:
API Documentation
You can view full API documentation on Tencent Cloud official website:
Was this page helpful?