/*
* Copyright (c) 2021 NetEase, Inc. All rights reserved.
* Use of this source code is governed by a MIT license that can be found in the LICENSE file.
*/
package com.beautyFaceunity;
import android.content.Context;
import android.hardware.Camera;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import com.beautyFaceunity.entity.Effect;
import com.beautyFaceunity.entity.LightMakeupItem;
import com.beautyFaceunity.entity.MakeupEntity;
import com.beautyFaceunity.gles.core.GlUtil;
import com.beautyFaceunity.param.BeautificationParam;
import com.beautyFaceunity.param.BodySlimParam;
import com.beautyFaceunity.param.CartoonFilterParam;
import com.beautyFaceunity.param.HairParam;
import com.beautyFaceunity.param.MakeupParamHelper;
import com.faceunity.wrapper.faceunity;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
/**
* 一个基于FaceUnity Nama SDK的简单封装,方便简单集成,理论上简单需求的步骤:
* <p>
* 1.通过 OnFUControlListener 在UI上进行交互
* 2.合理调用FURenderer构造函数
* 3.对应的时机调用onSurfaceCreated和onSurfaceDestroyed
* 4.处理图像时调用onDrawFrame
*/
public class FURenderer implements OnFUControlListener {
private static final String TAG = FURenderer.class.getSimpleName();
public static final int FU_ADM_FLAG_EXTERNAL_OES_TEXTURE = faceunity.FU_ADM_FLAG_EXTERNAL_OES_TEXTURE;
public static final int FACE_LANDMARKS_75 = faceunity.FUAITYPE_FACELANDMARKS75;
public static final int FACE_LANDMARKS_239 = faceunity.FUAITYPE_FACELANDMARKS239;
/**
* 外部输入类型
*/
public static final int EXTERNAL_INPUT_TYPE_NONE = -1;
public static final int EXTERNAL_INPUT_TYPE_IMAGE = 0;
public static final int EXTERNAL_INPUT_TYPE_VIDEO = 1;
/**
* 算法检测类型
*/
public static final int TRACK_TYPE_FACE = faceunity.FUAITYPE_FACEPROCESSOR;
public static final int TRACK_TYPE_HUMAN = faceunity.FUAITYPE_HUMAN_PROCESSOR;
public static final int TRACK_TYPE_GESTURE = faceunity.FUAITYPE_HANDGESTURE;
private Context mContext;
// 图形道具文件夹
private static final String GRAPHICS_ASSETS_DIR = "graphics/";
// fxaa.bundle:3D绘制抗锯齿数据文件,加载后3D绘制效果更加平滑。
private static final String BUNDLE_FXAA = GRAPHICS_ASSETS_DIR + "fxaa.bundle";
// 美颜 bundle
private static final String BUNDLE_FACE_BEAUTIFICATION = GRAPHICS_ASSETS_DIR + "face_beautification.bundle";
// 美发正常色 bundle
private static final String BUNDLE_HAIR_NORMAL = "effect/hair_seg/hair_normal.bundle";
// 美发渐变色 bundle
private static final String BUNDLE_HAIR_GRADIENT = "effect/hair_seg/hair_gradient.bundle";
// 海报换脸 bundle
private static final String BUNDLE_CHANGE_FACE = "change_face/change_face.bundle";
// 动漫滤镜 bundle
private static final String BUNDLE_CARTOON_FILTER = GRAPHICS_ASSETS_DIR + "fuzzytoonfilter.bundle";
// 轻美妆 bundle
private static final String BUNDLE_LIGHT_MAKEUP = "light_makeup/light_makeup.bundle";
// 美妆 bundle
private static final String BUNDLE_FACE_MAKEUP = GRAPHICS_ASSETS_DIR + "face_makeup.bundle";
// 美体 bundle
private static final String BUNDLE_BEAUTIFY_BODY = GRAPHICS_ASSETS_DIR + "body_slim.bundle";
//fixme 暂时用不到,为了减小包大小,删除资源,后续如果用到重新添加资源
// 算法模型文件夹
private static final String AI_MODEL_ASSETS_DIR = "model/";
// 人脸识别算法模型
private static final String BUNDLE_AI_MODEL_FACE_PROCESSOR = AI_MODEL_ASSETS_DIR + "ai_face_processor_lite.bundle";
// 舌头识别算法模型
private static final String BUNDLE_TONGUE = GRAPHICS_ASSETS_DIR + "tongue.bundle";
private static final String LANDMARKS = "landmarks";
private static float sIsBeautyOn = 1.0F;
private static String sFilterName = BeautificationParam.ZIRAN_2;// 滤镜:自然 2
private static float mFilterLevel = 0.4f;//滤镜强度
private static float mBlurLevel = 0.7f;//磨皮程度
private static float mBlurType = 2.0f;//磨皮类型:精细磨皮
private static float mColorLevel = 0.3f;//美白
private static float mSharpen = 0.2f;//锐化
private static float mRedLevel = 0.3f;//红润
private static float mEyeBright = 0.0f;//亮眼
private static float mToothWhiten = 0.0f;//美牙
private static float mFaceShape = 4;//脸型:精细变形
private static float mFaceShapeLevel = 1.0f;//变形程度
private static float mCheekThinning = 0f;//瘦脸
private static float mCheekV = 0.5f;//V脸
private static float mCheekNarrow = 0f;//窄脸
private static float mCheekSmall = 0f;//小脸
private static float mEyeEnlarging = 0.4f;//大眼
private static float mIntensityChin = 0.3f;//下巴
private static float mIntensityForehead = 0.3f;//额头
private static float mIntensityMouth = 0.4f;//嘴形
private static float mIntensityNose = 0.5f;//瘦鼻
private static float sMicroPouch = 0f; // 去黑眼圈
private static float sMicroNasolabialFolds = 0f; // 去法令纹
private static float sMicroSmile = 0f; // 微笑嘴角
private static float sMicroCanthus = 0f; // 眼角
private static float sMicroPhiltrum = 0.5f; // 人中
private static float sMicroLongNose = 0.5f; // 鼻子长度
private static float sMicroEyeSpace = 0.5f; // 眼睛间距
private static float sMicroEyeRotate = 0.5f; // 眼睛角度
private int mFrameId = 0;
// 句柄索引
private static final int ITEM_ARRAYS_FACE_BEAUTY_INDEX = 0;
public static final int ITEM_ARRAYS_EFFECT_INDEX = 1;
private static final int ITEM_ARRAYS_LIGHT_MAKEUP_INDEX = 2;
private static final int ITEM_ARRAYS_ABIMOJI_3D_INDEX = 3;
private static final int ITEM_ARRAYS_BEAUTY_HAIR_INDEX = 4;
private static final int ITEM_ARRAYS_CHANGE_FACE_INDEX = 5;
private static final int ITEM_ARRAYS_CARTOON_FILTER_INDEX = 6;
private static final int ITEM_ARRAYS_FACE_MAKEUP_INDEX = 7;
private static final int ITEM_ARRAYS_BEAUTIFY_BODY = 10;
// 句柄数量
private static final int ITEM_ARRAYS_COUNT = 11;
// 海报换脸 track face 50 次,确保检测成功率
private static final int MAX_TRACK_COUNT = 50;
// 美发类型
public static final int HAIR_NORMAL = 0;
public static final int HAIR_GRADIENT = 1;
//美颜和其他道具的handle数组
private int[] mItemsArray = new int[ITEM_ARRAYS_COUNT];
//用于和异步加载道具的线程交互
private Handler mFuItemHandler;
private boolean isNeedFaceBeauty = true;
private boolean isNeedBeautyHair = false;
private boolean isNeedAnimoji3D = false;
private boolean isNeedPosterFace = false;
private boolean isNeedBodySlim = false;
private Effect mDefaultEffect;//默认道具
private boolean mIsCreateEGLContext; //是否需要手动创建EGLContext
private int mInputTextureType = 0; //输入的图像texture类型,Camera提供的默认为EXTERNAL OES
private int mInputImageFormat = 0;
private volatile boolean mIsNeedUpdateFaceBeauty = true;
private float mBodySlimStrength = 0.0f; // 瘦身
private float mLegSlimStrength = 0.0f; // 长腿
private float mWaistSlimStrength = 0.0f; // 细腰
private float mShoulderSlimStrength = 0.5f; // 美肩
private float mHipSlimStrength = 0.0f; // 美胯
private float mHead
没有合适的资源?快使用搜索试试~ 我知道了~
基于Objective-C和跨平台技术的OnlinePK游戏设计源码
共1722个文件
png:554个
java:252个
h:232个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 38 浏览量
2024-09-30
03:22:24
上传
评论
收藏 46.45MB ZIP 举报
温馨提示
该项目是一款采用Objective-C编写的OnlinePK游戏源码,支持跨平台运行。源码集合了多种编程语言,包括Java, MATLAB, Python, HTML等,共计1714个文件。其中,包含554个PNG图片文件、252个Java源文件、232个Objective-C头文件、215个Objective-C实现文件、212个JSON文件、172个XML文件、12个Gradle构建脚本、11个Git忽略规则文件、9个项目配置文件和8个资源包文件。
资源推荐
资源详情
资源评论
收起资源包目录
基于Objective-C和跨平台技术的OnlinePK游戏设计源码 (1722个子文件)
netease-network.aar 34KB
netease-picture.aar 30KB
gradlew.bat 2KB
ai_face_processor_lite.bundle 5.85MB
controller.bundle 1.62MB
face_beautification.bundle 1.55MB
fuzzytoonfilter.bundle 1.24MB
face_makeup.bundle 1.15MB
tongue.bundle 621KB
body_slim.bundle 10KB
fxaa.bundle 2KB
NLiteAVDemo.entitlements 181B
.gitignore 2KB
.gitignore 92B
.gitignore 50B
.gitignore 20B
.gitignore 6B
.gitignore 6B
.gitignore 6B
.gitignore 6B
.gitignore 6B
.gitignore 6B
.gitignore 6B
.gitkeep 0B
NELiteAVDemo_Profile_InHouse.mobileprovision.gpg 5KB
cert.p12.gpg 3KB
release.jks.gpg 2KB
build.gradle 3KB
build.gradle 3KB
build.gradle 2KB
build.gradle 2KB
build.gradle 2KB
build.gradle 1KB
build.gradle 1KB
build.gradle 1KB
build.gradle 1KB
build.gradle 1017B
utils.gradle 514B
settings.gradle 390B
gradlew 5KB
NETSLiveModel.h 15KB
LOTAnimationView.h 12KB
LOTValueDelegate.h 10KB
LOTBlockCallback.h 10KB
NETSLiveApi.h 6KB
NETSPkEnum.h 5KB
CGGeometry+LOTAdditions.h 5KB
NETSChatroomService.h 4KB
NETSLiveAttachment.h 4KB
UIBezierPath.h 4KB
NETSPkService.h 4KB
NETSPkDelegate.h 4KB
LOTKeypath.h 3KB
NTESSegmentCtrl.h 3KB
LOTAnimationTransitionController.h 3KB
LOTValueCallback.h 3KB
LOTInterpolatorCallback.h 3KB
NSMacro.h 3KB
NETSAlertPrompt.h 3KB
NETSPkService+Inviter.h 3KB
NETSPkService+Invitee.h 3KB
NEAccount.h 3KB
LOTLayer.h 2KB
NETSPkService+im.h 2KB
UIColor+Expanded.h 2KB
LOTAnimatorNode.h 2KB
LOTComposition.h 2KB
NETSPushStreamService.h 2KB
NETSFUManger.h 2KB
NETSLiveChatViewHandle.h 2KB
NETSViewFactory.h 2KB
NETSBaseViewController.h 2KB
NETSMoreSettingModel.h 2KB
LOTTransformInterpolator.h 2KB
UIView+Gradient.h 2KB
LOTAnimatedSwitch.h 2KB
NETSLiveSegmentedSetting.h 2KB
NETSRequest.h 2KB
NETSAudienceMask.h 2KB
NETSLiveConfig.h 2KB
LOTCompositionContainer.h 2KB
UIView+NTES.h 2KB
NETSAudioMixingItem.h 1KB
NETSGCDTimer.h 1KB
LOTKeyframe.h 1KB
SKVObject.h 1KB
NETSConnectMicModel.h 1KB
LOTBezierPath.h 1KB
NENavigator.h 1KB
NETSPkStatusBar.h 1KB
NEEvaluateTask.h 1KB
UIColor.h 1KB
NETSBaseActionSheet.h 1KB
NECountDownButton.h 1KB
LOTLayerContainer.h 1KB
NETSInputToolBar.h 1KB
NETSAnchorBottomPanel.h 1KB
NETSApiOptions.h 1KB
NETSConnectManageCell.h 1KB
NETSAnchorChatroomMessageHandle.h 1KB
共 1722 条
- 1
- 2
- 3
- 4
- 5
- 6
- 18
资源评论
wjs2024
- 粉丝: 2368
- 资源: 5477
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- base(1).apk.1
- K618977005_2012-12-6_beforeP_000.txt.PRM
- 秋招信息获取与处理基础教程
- 程序员面试笔试面经技巧基础教程
- Python实例-21个自动办公源码-数据处理技术+Excel+自动化脚本+资源管理
- 全球前8GDP数据图(python动态柱状图)
- 汽车检测7-YOLO(v5至v9)、COCO、CreateML、Darknet、Paligemma、TFRecord、VOC数据集合集.rar
- 检测高压线电线-YOLO(v5至v9)、COCO、Darknet、VOC数据集合集.rar
- 检测行路中的人脸-YOLO(v5至v9)、COCO、CreateML、Darknet、Paligemma、VOC数据集合集.rar
- Image_17083039753012.jpg
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功