tencent cloud

Tencent Effect SDK

Release Notes and Announcements
Release Notes
Tencent Effect SDK V3.5 Version Released
Tencent Effects SDK V3.0 Version Related API and Material Changes
Product Introduction
Overview
Features
Basic Concepts
Strengths
Use Cases
Purchase Guide
Pricing Overview
Purchase Guide
Payment Overdue and Refund
Tutorial
Demos
Free Trial License
Licenses
Adding and Renewing a License (Mobile)
Adding and Renewing a License (Desktop)
Adding and Renewing a License (Web)
FAQs
SDK Download
Features
SDK Download
Version History
SDK Integration Guide(No UI)
General Integration of Tencent Effect
Integrating Capabilities
SDK Integration Guide(Including UI)
General Integration of Tencent Effect
Integrating Tencent Effect into MLVB SDK
Integrating Tencent Effect into TRTC SDK
Integrating Tencent Effect into UGSV SDK
Virtual Avatars
API Documentation
iOS
Android
Flutter
Web
Feature Guide
Reducing SDK Size
SDK Integration Issue Troubleshooting
Performance Fine-Tuning
Effect Fine-Tuning
Material Usage
Effect Parameters
Recommended Parameters in Beautification Scenarios
UGSV Enterprise Edition Migration Guide
Integrating Tencent Effect for Third-Party Publishers (Flutter)
Integrating Beauty AR Web into Mini Programs
Tencent Effect Studio Usage
Beauty AR Web
Overview
Quick Start
SDK Integration
Parameters and APIs
Console Guide
Demos
Preset Effect List
Practical Tutorial
FAQs
FAQs
General
Technical
License
Legacy Documentation
Recommended Parameters in Beautification Scenarios
Beauty Parameters Table
One-Minute Integration of TRTC
One-Minute Integration of Live Streaming
TE SDK Policy
Privacy Policy
Data Processing And Security Agreement
Contact Us

Android

PDF
Focus Mode
Font Size
Last updated: 2023-06-01 09:53:18

Function Description

Input a photo containing a face and output facial feature information of the person, including eyes, eyebrows, hairstyle, skin color, gender, age, etc. This interface requires internet connection, and the SDK will upload the photo to the server for parsing.

Integration Guide

First, you need to integrate Tencent Effect SDK, please refer to Independent Integration of Tencent Effect for details.

Interface Description

XMagicApi.java
public void getFaceFeatureFromPhoto(Bitmap bitmap, FaceFeatureListener listener);
Parameter bitmap: Please try to make the face in the center of the picture. It is recommended that the picture only contains one face. If there are multiple faces, the SDK will randomly select one. It is recommended that the short side of the photo be greater than or equal to 500px. A small size will affect the recognition effect.
Parameter FaceFeatureListener, returns the recognition result.
public interface FaceFeatureListener {
void onError(int errCode, String msg);
void onFinish(FaceDetailAttributesInfo faceInfo);
}
onError callback: This interface will be called back when the parsing fails, and the error codes are as follows.
public static final int ERROR_NO_AUTH = 1; // No permission
public static final int ERROR_RES_INVALID = 5;//Invalid Avatar material path
public static final int ERROR_PHOTO_INVALID = 10;//Failed to read the photo
public static final int ERROR_NETWORK_REQUEST_FAILED = 20; // Network request failed
public static final int ERROR_DATA_PARSE_FAILED = 30; // Failed to parse network return data
public static final int ERROR_ANALYZE_FAILED = 40; // Face analysis failed
public static final int ERROR_AVATAR_SOURCE_DATA_EMPTY = 50; // Failed to load Avatar source data
onFinish callback: This interface will be called back when the parsing is successful, and FaceDetailAttributesInfo is explained as follows.
public  static  class  FaceDetailAttributesInfo  {
public  int  age;   //[0,100]
public  int  emotion;     //0: natural, 1: happy, 2: surprised, 3: angry, 4: sad, 5: disgusted, 6: afraid
public  Eye  eye;      // Eye information
public  Eyebrow  eyebrow;  // Eyebrow information
public  int  gender;   // Gender information. -1: not recognized, 0: male, 1: female.
public  Hair  hair;    // Hairstyle information
public  Hat  hat;      // Hat information
public  int  mask;     // Whether there is a mask. -1: not recognized, 0: no, 1: yes.
public  int  moustache;    // Moustache information. -1: not recognized, 0: no moustache, 1: has moustache.


public  int  nose;     // Nose information. -1: not recognized, 0: upturned nose, 1: hooked nose, 2: normal, 3: round nose.
public  int  shape;    // Face shape information. -1: not recognized, 0: square face, 1: triangular face, 2: oval face, 3: heart-shaped face, 4: round face.
public  int  skin;     // Skin color information. -1: not recognized, 0: yellow skin, 1: brown skin, 2: black skin, 3: white skin.
public  int  smile;    // Smile degree, [0,100].
}


public  static  class  Eye  {    
public  int  eyelidType;   // Whether double eyelids are recognized. -1: not recognized, 0: no, 1: yes.
    
public  int  eyeSize;      // Eye size. -1: not recognized, 0: small eyes, 1: normal eyes, 2: big eyes.
    
public  int  glass;        // Whether wearing glasses is recognized. -1: not recognized, 0: no glasses, 1: normal glasses, 2: sunglasses.
    
public  int  eyeOpen;      // Recognize the opening and closing state of the eyes. -1: not recognized, 0: open, 1: closed.
}


public  static  class  Eyebrow  {    
public  int  eyebrowLength;    // Eyebrow length. 0: short eyebrows, 1: long eyebrows.
    
public  int  eyebrowDensity;   // Eyebrow density. 0: light eyebrows, 1: thick eyebrows.
    
public  int  eyebrowCurve;     // Eyebrow curvature. 0: not curved, 1: curved eyebrows.
}


public  static  class  Hair  {    
public  int  length;  // Hair length information. 0: bald, 1: short hair, 2: medium hair, 3: long hair, 4: tied hair.
    
public  int  bang;     // Bangs information. 0: no bangs, 1: with bangs.
    
public  int  color;     // Hair color information. 0: black, 1: golden, 2: brown, 3: gray-white.
}


public  static  class  Hat  {    
public  int  style;    // Hat wearing status information. 0: no hat, 1: normal hat, 2: helmet, 3: security hat.
    
public  int  color;    // Hat color. 0: no hat, 1: red series, 2: yellow series, 3: blue series, 4: black series, 5: gray-white series, 6: mixed color series.
}


Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback