fun getInstance(): FURenderKit
protected FURenderKit mFURenderKit = FURenderKit.getInstance();
单例模式
fun release()
mFURenderKit.release();
移除特效、释放所有内存以及资源
属性 | 分类 | 类型 | 默认值 | 备注 |
actionRecognition | 功能 | ActionRecognition | null | 动作识别 |
animationFilter | 功能 | AnimationFilter | null | 动漫滤镜 |
antialiasing | 功能 | Antialiasing | null | 3D抗锯齿 |
bgSegGreen | 功能 | BgSegGreen | null | 绿幕抠像 |
bodyBeauty | 功能 | BodyBeauty | null | 美体 |
faceBeauty | 功能 | FaceBeauty | null | 美颜 |
hairBeauty | 功能 | HairBeautyNormal | null | 美发 |
lightMakeup | 功能 | LightMakeup | null | 轻美妆 |
makeup | 功能 | Makeup | null | 美妆 |
musicFilter | 功能 | MusicFilter | null | 音乐滤镜 |
propContainer | 业务 | PropContainer | PropContainer | 多道具容器 |
avatarContainer | 业务 | AvatarContainer | AvatarContainer | PTA场景 |
FUAIController | 业务 | FUAIController | FUAIController | AI驱动管理 |
多道具容器,管理类似 道具贴纸、搞笑大头、表情识别、哈哈镜、手势识别、Animoji、AR面具、人像分割等业务 | 子类 |说明| | ------ | --------- | | Sticker | 道具贴纸 | | Animoji | Animoji | | ARMask | AR面具 | | HumanOutline | 人体分割线 | | PortraitSegment | 人像分割 | | BgSegCustom | 自定义背景分割 | | BigHead | 搞笑大头 | | ExpressionRecognition | 表情识别 | | FaceWarp | 哈哈镜 | | GestureRecognition | 手势识别 | | MakeupSticker | 美妆贴纸 | | FineSticker | 精品贴纸 |
fun addProp(prop: Prop): Boolean
prop:多道具抽象类
propContainer.addProp( prop);
fun removeProp(prop: Prop): Boolean
prop:多道具抽象类
propContainer.removeProp( currentAnimoji);
fun removeAllProp(): Boolean
propContainer.removeAllProp( );
fun replaceProp(oldProp: Prop?, newProp: Prop?): Boolean
oldProp:需要被替换的道具 newProp:新的道具
propContainer.replaceProp(currentAnimoji, prop);
oldProp为null执行新道具添加 newProp为null执行旧道具删除
fun getAllProp(): List<Prop>
Photo To Avatar场景使用
fun addScene(scene: Scene, listener: OnSceneListener? = null)
Scene:PTA场景模型
FUSceneKit.getInstance().addScene(sceneModel);
fun removeScene(scene: Scene)
Scene:PTA场景模型
FUSceneKit.getInstance().removeScene(sceneModel);
fun removeAllScene()
FUSceneKit.getInstance().removeAllScene( );
fun getAllScene(): List<Scene>
AI相关管理类
fun loadAIProcessor(path: String, aiType: FUAITypeEnum)
path:驱动对应地址 aiType:驱动类型
FUAIKit.getInstance().loadAIProcessor(DemoConfig.BUNDLE_AI_FACE, FUAITypeEnum.FUAITYPE_FACEPROCESSOR);
fun isAIProcessorLoaded(aiType: FUAITypeEnum):Boolean
aiType:驱动类型
fun releaseAIProcessor(aiType: FUAITypeEnum)
aiType:驱动类型
fun releaseAllAIProcessor()
fun setTrackFaceAIType(aiType: FUAITypeEnum)
aiType:驱动类型
fun trackFace(imgBuffer: ByteArray, format: FUInputBufferEnum, width: Int, height: Int): Int
imgBuffer:ByteArray format:数据类型 width:宽 height:高
fun trackFace(imgBuffer: ByteArray, format: FUInputBufferEnum, width: Int, height: Int, rotMode: Int): Int
imgBuffer:ByteArray format:数据类型 width:宽 height:高 rotMode:识别角度
fun humanProcessorGetNumResults(): Int
fun handProcessorGetNumResults(): Int
fun isTracking(): Int
fun setFaceProcessorDetectMode(mode: FUFaceProcessorDetectModeEnum)
fun getFaceInfo(faceId: Int, name: String, value: FloatArray)
信息名称 | 长度 | 类型 | 含义 | 权限 |
face_rect | 4 | float | 人脸矩形框,图像分辨率坐标,数据为 (x_min, y_min, x_max, y_max) | 默认 |
rotation_mode | 1 | int | 识别人脸相对于设备图像的旋转朝向,取值范围 0-3,分别代表旋转0度、90度、180度、270度 | 默认 |
failure_rate[已废弃] | 1 | float | 人脸跟踪的失败率,表示人脸跟踪的质量。取值范围为 0-2,取值越低代表人脸跟踪的质量越高 | 默认 |
is_calibrating | 1 | int | 表示是否SDK正在进行主动表情校准,取值为 0 或 1。 | 默认 |
focal_length | 1 | float | SDK当前三维人脸跟踪所采用的焦距数值 | 默认 |
landmarks | 75*2 | float | 人脸 75 个特征点,图像分辨率坐标 | Landmark |
landmarks_ar | 75*3 | float | 3D 人脸特征点 | Avatar |
rotation | 4 | float | 人脸三维旋转,数据为旋转四元数* | Landmark |
translation | 3 | float | 人脸三维平移,数据为 (x, y, z) | Landmark |
eye_rotation | 4 | float | 眼球旋转,数据为旋转四元数*,上下22度,左右30度。 | Landmark |
eye_rotation_xy | 2 | float | 眼球旋转,数据范围为[-1,1],第一个通道表示水平方向转动,第二个通道表示垂直方向转动 | Landmark |
expression | 46 | float | 人脸表情系数,表情系数含义可以参考《Expression Guide》 | Avatar |
expression_with_tongue | 56 | float | 1-46为人脸表情系数,同上expression,表情系数含义可以参考《Expression Guide》。47-56为舌头blendshape系数 | Avatar |
armesh_vertex_num | 1 | int | armesh三维网格顶点数量 | armesh |
armesh_face_num | 1 | int | armesh三维网格三角面片数量 | armesh |
armesh_vertices | armesh_vertex_num * 3 | float | armesh三维网格顶点位置数据 | armesh |
armesh_uvs | armesh_vertex_num * 2 | float | armesh三维网格顶点纹理数据 | armesh |
armesh_faces | armesh_face_num * 3 | int | armesh三维网格三角片数据 | armesh |
armesh_trans_mat | 4x4 | float | armesh 的transformation。 注意: 1. 获取'armesh_trans_mat'前需要先获取对应脸的'armesh_vertices'。2. 该trans_mat,相比使用'position'和'rotation'重算的transform更加准确,配合armesh,更好贴合人脸。 | armesh |
tongue_direction | 1 | int | 舌头方向,数值对应 FUAITONGUETYPE 定义,见下表。 | Avatar |
expression_type | 1 | int | 表情识别,数值对应 FUAIEXPRESSIONTYPE定义,见下表。 | Avatar |
rotation_euler | 3 | float | 返回头部旋转欧拉角,分别为roll、pitch、yaw | 默认 |
faceId:人脸标识 name:参数key value:返回值
属性 | 分类 | 类型 | 默认值 | 备注 |
maxFaces | 业务 | Int | 4 | 最大人脸数 |
maxHumans | 业务 | Int | 1 | 最大人体数 |
fun renderWithInput(input: FURenderInputData): FURenderOutputData
input:单帧渲染数据模型 return: 渲染后的数据模型
属性 | 上级 | 类型 | 默认值 | 备注 |
width | Int | 宽 | ||
height | Int | 高 | ||
texture | FUTexture | null | 纹理参数 | |
imageBuffer | FUImageBuffer | null | buffer参数 | |
renderConfig | FURenderConfig | null | 渲染配置 | |
texId | texture | Int | 纹理id | |
inputTextureType | texture | FUInputTextureEnum | 纹理类型 | |
inputBufferType | imageBuffer | FUInputBufferEnum | buffer类型 | |
buffer | imageBuffer | ByteArray | null | 数据Buffer /YUV_BUFFER 对应Y-Buffer |
buffer1 | imageBuffer | ByteArray | null | 数据Buffer YUV_BUFFER 对应U-Buffer |
buffer2 | imageBuffer | ByteArray | null | 数据Buffer /YUV_BUFFER 对应V-Buffer |
externalInputType | renderConfig | FUExternalInputEnum | FUExternalInputEnum.EXTERNAL_INPUT_TYPE_CAMERA | 数据源类型:相机、图片、视频 |
inputTextureType | renderConfig | FUInputTextureEnum | FUInputTextureEnum.FU_ADM_FLAG_COMMON_TEXTURE | 纹理类型 |
inputOrientation | renderConfig | Int | 0 | 数据源人脸朝向:0,90,180,270 |
deviceOrientation | renderConfig | Int | 90 | 手机硬件朝向-陀螺仪获取:0,90,180,270 |
cameraFacing | renderConfig | CameraFacingEnum | CameraFacingEnum.CAMERA_FRONT | 数据源为相机时候->前置、后置摄像头 |
inputTextureMatrix | renderConfig | FUTransfromMatrixEnum | FUTransfromMatrixEnum.CCROT0_FLIPVERTICAL | 输入纹理旋转调整角度 |
inputBufferMatrix | renderConfig | FUTransfromMatrixEnum | FUTransfromMatrixEnum.CCROT0 | 输入数据旋转调整角度 |
outputMatrix | renderConfig | FUTransfromMatrixEnum | FUTransfromMatrixEnum.CCROT0 | 输出数据旋转调整角度 |
isRenderFaceBeautyOnly | renderConfig | Boolean | false | 是否只使用美颜渲染 |
isNeedBufferReturn | renderConfig | Boolean | false | 是否需要合成后Buffer返回 |
一张图像最多只有8个方位方向,TRANSFORM_MATRIX定义了将一张图像进行变换,变换的顺序为先逆时针旋转,然后镜像。 DEFAULT或CCROT0默认输入方向不做处理。CCROT90为逆时针旋转90度。CCROT90_FLIPVERTICAL为先逆时针旋转90度,然后再竖直方向翻转。如下图所示,
属性 | 上级 | 类型 | 备注 |
texture | FUTexture | 纹理数据 | |
image | FUImageBuffer | 图象数据 | |
texId | texture | Int | 纹理id |
width | texture | Int | 宽 |
height | texture | Int | 高 |
buffer | image | ByteArray | 数据Buffer YUV_BUFFER 对应Y-Buffer |
buffer1 | image | ByteArray | 数据Buffer YUV_BUFFER 对应U-Buffer |
buffer2 | image | ByteArray | 数据Buffer YUV_BUFFER 对应V-Buffer |
width | image | Int | 宽 |
height | image | Int | 高 |
stride | image | Int | YUV数据stride |
stride1 | image | Int | YUV数据stride |
stride2 | image | Int | YUV数据stride |
fun setUseAsyncAIInference(isUse: Boolean): Int
isUse: 是否使用
fun setUseMultiBuffer(isUseMultiGPUTexture: Boolean, isUseMultiCPUBuffer: Boolean): Int
isUseMultiGPUTexture: 是否使用MultiGPUTexture isUseMultiCPUBuffer:是否使用MultiCPUBuffer
fun setUseTexAsync(isUse: Boolean): Int
isUse: 是否使用
fun clearCacheResource(): Int