当前位置:网站首页>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-28 14:32:00 【HMS Core】
Last key “ Grin ” Sweeping the whole network , Whether it's short video users or social App Users are using this black Technology . When twos of friends get together to take group photos , In order to deal with the expression of individuals “ defects ”, Let everyone try to keep smiling , Always fine tune your expression , But if you need to make a complex face change, etc P Figure operation , The threshold is too high for users . Some users “ Camera fear ”, Don't smile when taking pictures 、 Look embarrassed ; Some users are not confident about their teeth , Dare not take photos and grin . And now , Huawei HMS Core Video editing services “ One click smile ” The function can well solve the needs of users , It can automatically detect the portrait in the photo , Modify the expression , So as to improve the level of happiness ; The detected human image can be changed from not smiling to smiling , You can also open your mouth and smile , The smile is natural and will not change the reasonable structure of the original face .

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 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 .
MediaApplication.getInstance().setAccessToken("your access token");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().setApiKey("your ApiKey");2.2 Set a unique identity ID, namely License ID.
License ID It is a valid voucher for control , You need to ensure that the settings License ID Uniqueness .
MediaApplication.getInstance().setLicenseId("License ID");2.2.1 initialization Editor Running environment
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
HuaweiVideoEditor editor = HuaweiVideoEditor.create(getApplicationContext());(2) Specifies the layout location of the preview window
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 .
<LinearLayout android: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 window LinearLayout mSdkPreviewContainer = view.findViewById(R.id.video_content_layout);// Set the layout hosted by the preview window editor.setDisplay(mSdkPreviewContainer);(3) Initialize the running environment , If License Authentication failure , Will throw out LicenseException.
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 .
try { editor.initEnvironment(); } catch (LicenseException error) { SmartLog.e(TAG, "initEnvironment failed: " + error.getErrorMsg()); finish(); return; }3 “ One click action ” Capability integration
// Add a one click smile AI Special effects , Only image resources are supported imageAsset.addFaceSmileAIEffect(new HVEAIProcessCallback() { @Override public void onProgress(int progress) { // One click smile AI Special effect processing progress } @Override public void onSuccess() { // One click smile AI Special effect processing succeeded } @Override public void onError(int errorCode, String errorMessage) { // One click smile AI Special effect processing failed }});// Interrupt one button smile AI Special effects processing imageAsset.interruptFaceSmile();// Remove one click smile AI Special effects imageAsset.removeFaceSmileAIEffect();HMS Core Video editing services In addition to supporting one click smile , 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 .
Learn more >>
visit Official website of Huawei developer Alliance
obtain 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 ~
边栏推荐
猜你喜欢

爆肝整理JVM十大模块知识点总结,不信你还不懂

八、picker用法 下拉框选择效果

Recommended super easy-to-use mobile screen recording software

TDengine 助力西门子轻量级数字化解决方案

UI开发中所遇到的各种坑

Thesis study -- masked generative disintegration

Langjing Technology (Trax China) "robot +ai" opens the era of Chinese retail meta universe

2022 high altitude installation, maintenance, removal of examination question bank and online simulated examination
C# 读取ini文件、键值对操作

35道MySQL面试必问题图解,这样也太好理解了吧
随机推荐
Afnetworking crash course
2022年熔化焊接与热切割考题及在线模拟考试
Iterator iterator interface
2022低压电工考试题及答案
Thoughts on the construction of some enterprise data platforms
Development and definition of software testing
复制excel行到指定行
ZABBIX distributed
数据库优化 理解这些就够了
Excel VBA 免密查看VBE加密代码
2022 high altitude installation, maintenance, removal of examination question bank and online simulated examination
35道MySQL面试必问题图解,这样也太好理解了吧
[ecmascript6] proxy and reflection
String转为long 类型报错原因:要转为long必须是int、double、float型[通俗易懂]
[线程安全问题] 多线程到底可能会带来哪些风险?
Solve the problem that uniapp wechat applet canvas cannot introduce fonts
pix2pix
十、时间戳
[translation] how to choose a network gateway for your private cloud
Three methods to disassemble the rotation array