当前位置:网站首页>How to make the characters in the photos laugh? HMS core video editing service one click smile function makes people smile more naturally
How to make the characters in the photos laugh? HMS core video editing service one click smile function makes people smile more naturally
2022-07-29 04:57:00 【nginx】

Before processing

After processing
Function is introduced
Enter a face containing one or more people ( Most support 3 people ) Pictures of the , Detect the face and smile it , Realize one click smile based on the original face information , Generate a smile picture .
Demo demonstration

Now let's practice how to access Huawei's video editing service , Realization “ One click smile ” function :
1. The development of preparation
For detailed preparation steps, please refer to the official website of Huawei developer alliance
2. Edit project integration
2.1 Set the authentication information of the application
Can pass api_key perhaps Access Token To set the application authentication information .
adopt setAccessToken Method setting Access Token, You can initialize the settings once when the application starts , There is no need to set it more than once .
adopt setApiKey Method setting api_key, You can initialize the settings once when the application starts , There is no need to set it more than once .
MediaApplication.getInstance().setAccessToken("your access token");
2.2 Set a unique identity ID, namely License ID.
MediaApplication.getInstance().setApiKey("your ApiKey");
License ID It is a valid voucher for control , You need to ensure that the settings License ID Uniqueness .
2.2.1 initialization Editor Running environment
MediaApplication.getInstance().setLicenseId("License ID");
Create edit project , You need to create it first Editor Object and initialize its running environment . When you leave editing a project , Should be released Editor example .
(1) establish Editor object
(2) Specifies the layout location of the preview window
HuaweiVideoEditor editor = HuaweiVideoEditor.create(getApplicationContext());
The preview window is responsible for the rendering of video images , Atomic power by video editing SDK Create inside SurfaceView To achieve . Before creating the window , Need to be in your App Specify the layout location of the preview window in .
(3) Initialize the running environment , If License Authentication failure , Will throw out LicenseException.
<LinearLayoutandroid:id="@+id/video_content_layout"android:layout_width="0dp"android:layout_height="0dp"android:background="@color/video_edit_main_bg_color"android:gravity="center"android:orientation="vertical" />// Specify the preview windowLinearLayout mSdkPreviewContainer = view.findViewById(R.id.video_content_layout);// Set the layout hosted by the preview windoweditor.setDisplay(mSdkPreviewContainer);
When Editor After the object is created , At this time, the actual system resources have not been occupied , You need to manually select the timing of its environment initialization , At this point, the atomic power of video editing SDK Necessary threads and timers will be created internally .
3“ One click action ” Capability integration
try {editor.initEnvironment();} catch (LicenseException error) {SmartLog.e(TAG, "initEnvironment failed: " + error.getErrorMsg());finish();return;}
HMS Core In addition to supporting one click smile, video editing services , It also provides basic video editing 、AI To color 、 Exclusive filter 、 Highlights 、 One button hair dyeing 、 Character tracking 、 Video creation ability such as face hiding , Developers can choose according to the application scenario , stay App Easily complete the integration of video functions .
// Add a one click smile AI Special effects , Only image resources are supportedimageAsset.addFaceSmileAIEffect(new HVEAIProcessCallback() {@Overridepublic void onProgress(int progress) {// One click smile AI Special effect processing progress}@Overridepublic void onSuccess() {// One click smile AI Special effect processing succeeded}@Overridepublic void onError(int errorCode, String errorMessage) {// One click smile AI Special effect processing failed}});// Interrupt one button smile AI Special effects processingimageAsset.interruptFaceSmile();// Remove one click smile AI Special effectsimageAsset.removeFaceSmileAIEffect();
Learn more >>
Visit the official website of Huawei developer alliance
Get development guidance document
Huawei mobile service open source warehouse address :GitHub、Gitee
Pay attention to our , The first time to understand HMS Core Latest technical information ~
边栏推荐
- P5714 [deep foundation 3. Case 7] obesity
- pulsar起client客户端时(client,producer,consumer)各个配置
- 盒子水平垂直居中布局(总结)
- PHP determines whether the user has logged in. If logged in, the home page will be displayed. If not, enter the login page or registration page
- Introduction to auto.js script development
- Use annotation test in idea
- JS daily question (10)
- Take you to understand JS array
- Implementation of img responsive pictures (including the usage of srcset attribute and sizes attribute, and detailed explanation of device pixel ratio)
- Word如何查看文档修改痕迹?Word查看文档修改痕迹的方法
猜你喜欢

Take you to understand JS array

How is the entered query SQL statement executed?

Introduction of JDBC preparestatement+ database connection pool

Improve the readability of your regular expressions a hundred times

Climbing the pit of traffic flow prediction (III): using pytorch to realize LSTM to predict traffic flow

spinning up安装完使用教程测试是否成功,出现Library“GLU“ not found和‘from pyglet.gl import *错误解决办法

Data Lake: spark, a distributed open source processing engine

The most comprehensive promotion plan for the launch of new products

A little knowledge about management

Glory 2023 push, push code ambubk
随机推荐
Torch.nn.crossentropyloss() details
EF Core: 一对一,多对多的配置
stack和queue和优先级队列(大堆和小堆)模拟实现和仿函数讲解
leetcode 763. Partition Labels 划分字母区间(中等)
Flink+Iceberg环境搭建及生产问题处理
Flink+iceberg environment construction and production problem handling
Spark的算子操作列表
Sguard64.exe ace guard client exe: frequent disk reading and writing, game jamming, and Solutions
SSM integration, addition, deletion, modification and query
央企建筑企业数字化转型核心特征是什么?
EMI interference troubleshooting with near-field probe and current probe
软件测试面试题(四)
Makefile+make Basics
Wechat picture identification
ThreadPoolExecutor simple to use
ios面试准备 - objective-c篇
PHP判断用户是否已经登录,如果登录则显示首页,如果未登录则进入登录页面或注册页面
The difference between the two ways of thread implementation - simple summary
Implementation of flutter gesture monitoring and Sketchpad
Traffic flow prediction pit climbing record (I): traffic flow data set, original data