tencent cloud

文档反馈

最后更新时间:2023-05-18 16:32:22

    功能说明

    
    输入相机的 openGL 纹理,实时输出人脸52表情 BlendShape 数据,遵循苹果 ARKit 规范,详情请参见 ARFaceAnchor。您可以利用这些表情数据做一进步的开发,例如传到 Unity 中驱动您的模型。

    Android 集成指引

    Android 集成 SDK 指引,具体请参见 独立集成腾讯特效

    接口调用

    1. 打开功能开关:
    //XmagicApi.java
    //featureName = XmagicConstant.FeatureName.ANIMOJI_52_EXPRESSION
    public void setFeatureEnableDisable(String featureName, boolean enable);
    
    2. 设置人脸点位信息数据回调。
    2.6.0及之前版本使用如下方法
    //XmagicApi.java
    void setYTDataListener(XmagicApi.XmagicYTDataListener ytDataListener)
    
    public interface XmagicYTDataListener {
    void onYTDataUpdate(String data)
    }
    3.0.0版本使用如下方法
    void setAIDataListener(XmagicApi.OnAIDataListener aiDataListener)
    
    public interface OnAIDataListener {
    void onFaceDataUpdated(List<TEFaceData> faceDataList);
    void onHandDataUpdated(List<TEHandData> handDataList);
    void onBodyDataUpdated(List<TEBodyData> bodyDataList);
    void onAIDataUpdated(String data); //此方法是3.0.0版本新增方法,数据结构和之前XmagicYTDataListener接口的数据保持一致
    }
    onYTDataUpdate 和 onAIDataUpdated 返回 JSON string 结构,最多返回5个人脸信息:
    {
    "face_info":[{
    "trace_id":5,
    "face_256_point":[
    180.0,
    112.2,
    ...
    ],
    "face_256_visible":[
    0.85,
    ...
    ],
    "out_of_screen":true,
    "left_eye_high_vis_ratio:1.0,
    "right_eye_high_vis_ratio":1.0,
    "left_eyebrow_high_vis_ratio":1.0,
    "right_eyebrow_high_vis_ratio":1.0,
    "mouth_high_vis_ratio":1.0,
    "expression_weights":[
    0.12,
    -0.32
    ...
    ]
    },
    ...
    ]
    }

    字段含义

    trace_id:人脸 ID,连续取流过程中,ID 相同的可以认为是同一张人脸。
    expression_weights:实时表情blendshape数据,数组长度为52,每个数值取值范围为 0到1.0。{"eyeBlinkLeft","eyeLookDownLeft","eyeLookInLeft","eyeLookOutLeft","eyeLookUpLeft","eyeSquintLeft","eyeWideLeft","eyeBlinkRight","eyeLookDownRight","eyeLookInRight","eyeLookOutRight","eyeLookUpRight","eyeSquintRight","eyeWideRight","jawForward","jawLeft","jawRight","jawOpen","mouthClose","mouthFunnel","mouthPucker","mouthRight","mouthLeft","mouthSmileLeft","mouthSmileRight","mouthFrownRight","mouthFrownLeft","mouthDimpleLeft","mouthDimpleRight","mouthStretchLeft","mouthStretchRight","mouthRollLower","mouthRollUpper","mouthShrugLower","mouthShrugUpper","mouthPressLeft","mouthPressRight","mouthLowerDownLeft","mouthLowerDownRight","mouthUpperUpLeft","mouthUpperUpRight","browDownLeft","browDownRight","browInnerUp","browOuterUpLeft","browOuterUpRight","cheekPuff","cheekSquintLeft","cheekSquintRight","noseSneerLeft","noseSneerRight","tongueOut"}
    其他字段是 人脸信息,只有当您购买了相关 License 才有那些字段。如果您只想获取表情数据,请忽略那些字段。
    联系我们

    联系我们,为您的业务提供专属服务。

    技术支持

    如果你想寻求进一步的帮助,通过工单与我们进行联络。我们提供7x24的工单服务。

    7x24 电话支持