tencent cloud

Feedback

API Access Guide

Last updated: 2024-10-16 11:47:57

    Prerequisites

    Prerequisites for Using the Official Website Account

    1. First, use your Tencent Cloud International site account to Sign in.
    
    
    
    2. Go to the API Key Management page to obtain the key information.
    
    
    
    3. If you use the sub-account key of Tencent Cloud International Site to call the API, the root account needs to authorize the sub-account. If you use the root account key, ignore this step.
    4. Go to the User List page, select the corresponding product name, and click Authorize.
    5. On the policy selection page, select the authorization policy QcloudFaceFusionFullAccess, and click OK.
    Description:
    If the sub-account is not authorized to call the API, the message You are not authorized to perform this operation. Check your CAM policies, and ensure that you are using the correct access keys will be prompted during the call.
    
    
    
    6. Go to the Face Fusion console to enable the service.
    Description:
    If the service is not enabled, the message The billing status is unknown. Check whether the service has been activated in the console will be prompted during the API call.

    Prerequisites for API Access

    Description:
    Due to the overseas access, the request duration might be higher than in China, mainly because the download of overseas images from URLs times out or the transmission of the large package that contains images to be transmitted in Base64 format is time-consuming.
    1. Use the request domain name facefusion.tencentcloudapi.com for nearby parsing.
    2. Suggestions for input information containing images:
    Use the Tencent COS address as the URL.
    Using the Tencent COS address: Images are downloaded through the private network from Tencent services, which can reduce download time.
    Using the CDN address: CDN addresses may involve origin-pull, which may cause a timeout and failure in the first download attempt. In this case, you can retry the request.
    If the input parameter is an image, it is recommended to transmit Base64-encoded data to reduce download time.
    3. Output image:
    If the request is not initiated by the client (App or HTML5), during the request, the client IP address is passed in through the X-Forwarded-For field in the HTTP header. In this case, Tencent Cloud services will return the resource address for the generated result based on the IP location.
    If the customer's service is already in the location of the client group, there is no need to pass the client IP address in through the X-Forwarded-For field. In this case, Tencent Cloud services will return the resource address for the generated result based on the customer's service IP address.

    API Calling Guide

    Image Face Fusion (Basic)

    There is an explanation of the interface parameters inside. Click "Try it" to enter the API Explorer for online testing. You need to upload materials in the console and obtain the ProjectId and ModelId before testing.
    
    
    

    API Using Testing

    Step 1: Selecting an API

    In the left sidebar, select FuseFace.
    
    
    

    Step 2: Installing the SDK of the Corresponding Language

    Currently, only the following programming languages are supported: Node.js, Python, Java, PHP, Go, .NET, and C++.
    Click Sample Code, choose Connection Method and Programming Language. If Connection Method is SDK or SDK Common Client, you need to install the corresponding SDK for the programming language via SDK Information and SDK Usage Guide.
    

    Step 3: Entering Parameters and Copying the Call Example

    1. In Input Parameters, input the parameter information, copy the sample code, and adjust the "SecretId" and "SecretKey" parameters for the call.
    Region: This parameter determines the access point, and you can choose the nearest region.
    ProjectId: Activity ID. View it in the activity list on the Face Fusion console material management page.
    
    
    
    ModelId: Material ID. In the activity list under material management on the Face Fusion console, click material management under operation, you can view the material ID in the list.
    
    
    
    MergeInfos.N: User face image and face position information of the material template.
    Image or Url: Either Image (base64 image data) or URL must be provided. If both are provided, URL takes precedence.
    TemplateFaceID: The face ID of the material image. Click view as shown below to see the material face and its corresponding FaceID (specify the face for fusion if there are multiple faces in the material image).
    
    
    
    InputImageFaceRect: The face position coordinates (face frame) in the user's image, specifying the user's face image for Face Fusion. If not provided, face detection will be called by default to use the largest face.
    RspImgType: Method of returning image (URL or base64), choose one. The URL is valid for 7 days.
    2. After the parameters are entered, copy the call example, as shown in the following figure.
    
    
    
    Description:
    Method of fusing multiple faces:
    A maximum of 6 faces in the material image can be fused. If no faces are specified, face detection will be called by default to use the largest face.
    If multiple faces need to be fused, click Add to continue entering the IDs of the faces to be fused, and fuse them with the user image by specifying TemplateFaceID of the material image.
    
    
    
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support