当前位置:网站首页>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 ~
边栏推荐
- Spark的算子操作列表
- The difference between the two ways of thread implementation - simple summary
- On prepayment of house purchase
- 学术 | [LaTex]超详细Texlive2022+Tex Studio下载安装配置
- 谷歌浏览器 打开网页出现 out of memory
- Leetcode 763. partition labels divide alphabetic intervals (medium)
- Mysql:The user specified as a definer (‘root‘@‘%‘) does not exist 的解决办法
- JDBC statement + resultset introduction
- Use jupyter (2) to establish shortcuts to open jupyter and common shortcut keys of jupyter
- Implementation of img responsive pictures (including the usage of srcset attribute and sizes attribute, and detailed explanation of device pixel ratio)
猜你喜欢
带你搞懂 Kubernetes 集群中几种常见的流量暴露方案
![[untitled]](/img/6c/df2ebb3e39d1e47b8dd74cfdddbb06.gif)
[untitled]

IOS interview preparation - IOS

Use openmap and ArcGIS to draw maps and transportation networks of any region, and convert OMS data into SHP format

Force deduction ----- sort odd and even subscripts respectively

Correct user dragging method
![学术 | [LaTex]超详细Texlive2022+Tex Studio下载安装配置](/img/4d/f8c60c0fbbd98c4da198cfac7989fa.png)
学术 | [LaTex]超详细Texlive2022+Tex Studio下载安装配置

【无标题】

Implementation of img responsive pictures (including the usage of srcset attribute and sizes attribute, and detailed explanation of device pixel ratio)

Review key points and data sorting of information metrology in the second semester of 2022 (teacher zhaorongying of Wuhan University)
随机推荐
EF Core: 一对一,多对多的配置
Climbing the pit of traffic flow prediction (II): the simplest LSTM predicts traffic flow using tensorflow2
Take you to understand JS array
1 句代码,搞定 ASP.NET Core 绑定多个源到同一个类
< El table column> place multiple pictures
Leetcode (Sword finger offer) - 53 - I. find the number I in the sorted array
Mysql各版本下载地址及多版本共存安装
Reply from the Secretary of jindawei: the company is optimistic about the market prospect of NMN products and has launched a series of products
un7.28:redis客户端常用命令。
IOS interview preparation - Objective-C
Connection database time zone setting
The song of the virtual idol was originally generated in this way!
pulsar起client客户端时(client,producer,consumer)各个配置
Solve the warning prompt of MySQL mapping file
虚拟偶像的歌声原来是这样生成的!
新产品上市最全推广方案
The most complete NLP Chinese and English stop words list in the whole station (including punctuation marks, which can be copied directly)
Simple user-defined authentication interface rules
Vivo market API event reporting and docking
Solution to the fourth game of 2022 Hangzhou Electric Multi school league