ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
**1.初始化SDK(To initialize the SDK )** ~~~ MHSDK.init(this,"你的授权密钥");//建议在Application子类的onCreate方法中初始化SDK ~~~ ~~~ MHSDK.init(this,"Your authorization key"); // It is recommended to initialize the SDK in the onCreate method of the Application subclass ~~~ ***** **2.添加美狐UI组件(Add the MHSDK UI component)** 在布局文件中添加美狐的UI组件 Add the UI component of the MHSDK to the layout file ``` <com.meihu.beauty.views.MeiHuBeautyControl android:layout_width="match_parent" android:layout_height="match_parent"/> ``` ***** **3.在集成了美狐UI组件的Activity中初始化(Class in an Activity that integrates the MHSDK UI component)** ~~~ //初始化(initialize) MhDataManager.getInstance().create(this.getApplicationContext()); ~~~ **4.在阿里的渲染方法中 调用美狐SDK的渲染方法(Call the rendering method of MHSDK in Ali's rendering method)** ~~~ int faceScale = 4; //人脸识别对纹理的缩小倍数 int textureScale = 2;//图像渲染对纹理的缩小倍数 if (mDeviceLevel == DEVICE_LEVEL_HIGH) { //判断手机性能 设置图像渲染对纹理的缩小倍数 textureScale = 1; } int newTexture = MhDataManager.getInstance().render(texture,width,height,faceScale,textureScale); return newTexture; ~~~ ~~~ int faceScale = 4; // Face recognition for texture reduction multiple int textureScale = 2; // The size of the image rendered texture If (mDeviceLevel == DEVICE_LEVEL_HIGH) {// Determine the phone performance set image rendering to texture reduction multiple textureScale = 1; } int newTexture = MhDataManager.getInstance().render(texture,width,height,faceScale,textureScale); return newTexture; ~~~