当前位置:网站首页>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 ~
边栏推荐
- The most comprehensive promotion plan for the launch of new products
- Excel卡住了没保存怎么办?Excel还没保存但是卡住了的解决方法
- [wechat applet -- solve the alignment problem of the last line of display:flex. (discontinuous arrangement will be divided into two sides)]
- WPS如何进行快速截屏?WPS快速截屏的方法
- Stack and queue and priority queue (large heap and small heap) simulation implementation and explanation of imitation function
- pulsar起client客户端时(client,producer,consumer)各个配置
- iOS面试准备 - 其他篇
- Various configurations when pulsar starts the client (client, producer, consumer)
- Mysql:the user specified as a definer ('root '@'%) does not exist
- The most complete NLP Chinese and English stop words list in the whole station (including punctuation marks, which can be copied directly)
猜你喜欢

新产品上市最全推广方案

After the spinning up installation is completed, use the tutorial to test whether it is successful. There are library "Glu" not found and 'from pyglet.gl import * error solutions

A little knowledge about management

Install the gym corresponding to mujoco in the spinning up tutorial, and the error mjpro150 is reported

C language implementation of three chess

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

mujoco和mujoco_py安装以及解决libXcursor.so.1:NO such dictionary

Review key points and data sorting of information metrology in the second semester of 2022 (teacher zhaorongying of Wuhan University)

SparkSql批量插入或更新,保存数据到Mysql中
带你搞懂 Kubernetes 集群中几种常见的流量暴露方案
随机推荐
Reveal installation configuration debugging
金达威董秘回复:公司看好NMN产品的市场前景,已推出系列产品
盒子水平垂直居中布局(总结)
SSM integration, addition, deletion, modification and query
IOS interview preparation - Online
电脑无法打开excel表格怎么办?excel打不开的解决方法
EF Core: 一对一,多对多的配置
Basic grammar of C language
Live in small private enterprises
P2181 diagonal
Review key points and data sorting of information metrology in the second semester of 2022 (teacher zhaorongying of Wuhan University)
OpenCV环境搭建
2021-10-11
Academic | [latex] super detailed texlive2022+tex studio download installation configuration
使用近场探头和电流探头进行EMI干扰排查
Introduction to auto.js script development
2022杭电多校联赛第四场 题解
ios面试准备 - 网络篇
[QT learning notes] * insert pictures in the window
Excel卡住了没保存怎么办?Excel还没保存但是卡住了的解决方法