Skip to content

Commit 0c9ec1c

Browse files
committed
[Android][ScenseTime]update README and etc.
1 parent de74d1e commit 0c9ec1c

13 files changed

Lines changed: 152 additions & 230 deletions

File tree

Android/APIExample/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ To build and run the sample application, get an App Id:
3737
3838
You are all set. Now connect your Android device and run the project.
3939
40+
### Beauty Configuration
41+
This project contains third-party beauty integration examples, which are disabled by default. If you need to enable compilation and use, please refer to the corresponding configuration guide.
42+
43+
| Beauty module | Configuration Guide |
44+
| :------: | :--------------------------------------: |
45+
| SenseTime | [README](beauty/sense-time/README.md) |
46+
47+
4048
### For Agora Extension Developers
4149
4250
从4.0.0SDK开始,Agora SDK支持插件系统和开放的云市场帮助开发者发布自己的音视频插件,本项目包含了一个SimpleFilter示例,默认是禁用的状态,如果需要开启编译和使用需要完成以下步骤:

Android/APIExample/README.zh.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@
3737
3838
然后你就可以编译并运行项目了。
3939
40+
### 美颜配置
41+
42+
本项目包含第三方美颜集成示例,默认是禁用状态,如果需要开启编译和使用请参考对应的配置指南。
43+
44+
| 美颜模块 | 配置指南 |
45+
| :------: | :--------------------------------------: |
46+
| 商汤 | [README](beauty/sense-time/README.zh.md) |
47+
48+
49+
4050
### 对于Agora Extension开发者
4151
4252
从4.0.0SDK开始,Agora SDK支持插件系统和开放的云市场帮助开发者发布自己的音视频插件,本项目包含了一个SimpleFilter示例,默认是禁用的状态,如果需要开启编译和使用需要完成以下步骤:

Android/APIExample/beauty/base/src/main/java/io/agora/beauty/base/IBeautySenseTime.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@ public interface IBeautySenseTime {
1313
* @param width camera preview width
1414
* @param height camera preview height
1515
* @param orientation camera preview orientation
16-
* @param mirror camera preview mirror
1716
* @param nv21 camera preview pixel data
1817
* @param textureId camera preview texture id
1918
* @param texFormat {@link GLES11Ext#GL_TEXTURE_EXTERNAL_OES} or {@link GLES20#GL_TEXTURE_2D}
20-
* @param texMatrix float[16]
2119
* @return new Texture ID to render
2220
*/
2321
public int process(
Lines changed: 53 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,77 @@
1-
# Agora RTC with SenseTime Android
1+
# Configuration Guide
2+
*English | [中文](README.zh.md)*
23

3-
A tutorial demo for Agora Video SDK can be found here: [Agora-Android-Tutorial-1to1](https://github.com/AgoraIO/Basic-Video-Call/tree/master/One-to-One-Video/Agora-Android-Tutorial-1to1)
4+
This example provides two SenseTime beauty access methods, single input (NV21 only) and dual input (NV21 and texture). Dual input has less NV21 to texture operation than single input, and the conversion performance is relatively high, but on low-end machines, the sticker may not follow the face, etc. It is recommended to choose the appropriate access method according to the customer.
5+
> The plug-in cloud market provides a more convenient integration method. You can log in to the sound network [console](https://console.agora.io/) to view the [integration tutorial](https://console.agora.io/ marketplace/license/introduce?serviceName=sensetime-ar)
46
5-
This demo demonstrates the combined use of Agora RTC sdk and SenseTime beautification library. You can do:
7+
## 1 SenseTime Beauty SDK
68

7-
- Join a channel and have video a chatting with friends;
8-
- SenseTime beauty, makeups and stickers for your video.
9-
10-
## 1 Configuration
11-
12-
### 1.1 Agora RTC
13-
#### 1.1.1 App Id
14-
15-
Create a developer account at [Agora.io](https://dashboard.agora.io/signin/), create a new project and obtain an App ID as the identification of the running app. Update "app/src/main/res/values/strings-config.xml" with your App ID.
16-
17-
```
18-
<string name="AGORA_APP_ID"><#YOUR APP ID#></string>
19-
```
20-
21-
#### 1.1.2 Agora SDK
22-
23-
There are two ways to add Agora Video SDK to the project:
24-
25-
* JCenter (recommended)
26-
* Download SDK from [Agora.io SDK](https://docs.agora.io/en/Agora%20Platform/downloads)
27-
28-
**The first method** will download Agora Video SDK automatically from JCenter when the project is building. Add the following line to "app/build.gradle" (which is default in the project):
29-
```
30-
implementation 'io.agora.rtc:full-sdk:4.0.0-rc.1'
31-
```
32-
33-
**The second method** needs developers to download SDK and copy the unzipped library files to proper project folders (acquires knowledge of the project structure):
34-
35-
* Copy ***.jar** under **libs** to **app/libs**
36-
* Copy **arm64-v8a**/**x86**/**armeabi-v7a** under **libs** to **app/src/main/jniLibs**.
37-
* Add the following code in the property of the dependence of the "app/build.gradle":
38-
39-
```
40-
implementation fileTree(dir: 'libs', include: ['*.jar'])
41-
```
42-
43-
### 1.2 SenseTime
44-
45-
#### 1.2.1 SenseTime SDK
46-
47-
Most the of code of SenseTime SDK is already provided in the **"sensetime"** module of the demo project. But things to note that developers need to download and copy .so libraries to **"sensetime/src/main/jniLibs"** folder:
9+
- Contact SenseTime customer service to get the latest sdk download address, download and unzip
10+
- Copy **libst_mobile.so** to **"beauty/sense-time/src/main/jniLibs"** folder
4811
```
4912
jniLibs
5013
|_ arm64-v8a
5114
|_ armeabi-v7a
5215
```
53-
54-
Other native code and JNI interfaces are all in the .arr files. Copy .aar libraries to **"sensetime/libs"** folder:
16+
- Copy **STMobileJNI-release.aar** and **SenseArSourceManager-release.aar** to **"beauty/sense-time/libs"** folder
5517
```
5618
libs
5719
|_ SenseArSourceManager-release.aar
5820
|_ STMobileJNI-release.aar
5921
```
6022

61-
#### 1.2.2 SenseTime Resources
23+
## 2 Beauty resources
24+
25+
Copy the resource files in the SDK to the **"beauty/sense-time/src/main/assets"** directory. The resource files used in this project are listed below:
26+
27+
- Model resources (required): Loaded in [STRenderer](src/main/java/com/sensetime/effects/STRenderer.java)
28+
models/M_Segment_DBLV2_Pant_1.1.6.model
29+
models/M_SenseME_3DMesh_Face_2.0.2.model
30+
models/M_SenseME_Attribute_1.0.1.model
31+
models/M_SenseME_Avatar_Help_2.2.0.model
32+
models/M_SenseME_CatFace_3.0.0.model
33+
models/M_SenseME_DogFace_2.0.0.model
34+
models/M_SenseME_Face_Extra_Advanced_6.0.13.model
35+
models/M_SenseME_Face_Video_7.0.0.model
36+
models/M_SenseME_Foot_1.0.2.model
37+
models/M_SenseME_Hand_5.4.0.model
38+
models/M_SenseME_Segment_4.14.1.model
39+
models/M_SenseME_Segment_DBL_Face_1.0.7.model
40+
models/M_SenseME_Segment_Hair_1.3.4.model
41+
models/M_SenseME_Segment_Head_1.0.3.model
42+
models/M_SenseME_Segment_MouthOcclusion_FastV1_1.1.3.model
43+
models/M_SenseME_Segment_Skin_1.1.1.model
44+
models/M_SenseME_Segment_Sky_1.0.3.model
45+
46+
- MakeUp resources (test resources): Loaded when beauty is enabled in [BeautySenseTimeImpl](src/main/java/io/agora/beauty/sensetime/BeautySenseTimeImpl.java)
47+
makeup_lip/12自然.zip
48+
49+
- Stickers (test resource): Loaded when stickers are enabled in [BeautySenseTimeImpl](src/main/java/io/agora/beauty/sensetime/BeautySenseTimeImpl.java)
50+
sticker_face_shape/lianxingface.zip
51+
52+
- Filter (test resource): Loaded when the filter is enabled in [BeautySenseTimeImpl](src/main/java/io/agora/beauty/sensetime/BeautySenseTimeImpl.java)
53+
filter_portrait/filter_style_babypink.model
6254

63-
Copy all resource files to **"sensetime/src/main/assets"** from the download link.
64-
Note: Current version is aligned with SenseAR SDK 8.x version. And sample has assign some default filter and stickers. If these resources are not available on your SDK, you may need to replace them with yours.
55+
Note: Filter resources are time-limited, and you need to get valid filter resources from SenseTime customer service.
6556

66-
#### 1.2.3 SenseTime Licence
57+
## 3 License
6758

68-
Developers must contact SenseTime to obtain the licence file. Change the file name as **"SenseMe.lic"** and copy the file to **"sensetime/src/main/assets/license"** folder.
59+
SenseTime provides two kinds of License configurations, one is the offline method using the local license file, and the other is the online method obtained through the SenseTime interface according to the applicationId. The following describes these two configuration methods in the project.
6960

70-
### 1.3 SenseTime In Extensions Marketplace
61+
### 3.1 Offline mode
62+
- Contact SenseTime customer service to get the license file, the license file is also divided **Online/Offline** need to pay attention
63+
- If it is an offline license, rename the certificate to **"SenseMe.lic"** , if it is an online license, rename it to **"SenseME_Online.lic"** , then copy **"beauty/sense-time/src/main/assets/license"** folder
64+
- Set the **USING_SERVER_LICENSE** variable in [STLicenseUtils](src/main/java/com/sensetime/effects/utils/STLicenseUtils.java) to false
65+
- According to whether the obtained license is offline, if it is offline, set the **USING_ASSETS_ONLINE_LICENSE** variable in [STLicenseUtils](src/main/java/com/sensetime/effects/utils/STLicenseUtils.java) to false, otherwise set it to true
7166

72-
The SenseTime extension is available in agora extensions marketplace. If you want to integrate the sdk via SenseTime extension, you can refer to the [document](https://github.com/AgoraIO-Community/AgoraMarketPlace/blob/master/SenseTime/README.md).
7367

74-
## Developer Environment Requirements
75-
- Android Studio 3.1 or above
76-
- Real devices (Nexus 5X or other devices)
77-
- Some simulators may have functions missing or have performance issue
68+
### 3.2 Online mode
69+
- Contact SenseTime customer service to configure the certificate corresponding to the appId of the application
70+
- Set the **USING_SERVER_LICENSE** variable in [STLicenseUtils](src/main/java/com/sensetime/effects/utils/STLicenseUtils.java) to true
7871

79-
## Connect Us
72+
## 4 Configure compilation
8073

81-
- You can find full Agora API document at [Document Center](https://docs.agora.io/en/)
82-
- You can file bugs about this demo at [issue](https://github.com/AgoraIO/Agora-With-SenseTime/issues)
74+
- Set the **beauty_sensetime** variable in **gradle.properties** in the project directory to true
75+
- compile and run
8376

84-
## License
8577

86-
The MIT License (MIT).
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# 配置指南
2+
*[English](README.md) | 中文*
3+
4+
此示例提供了两种商汤美颜接入方式,单输入(仅NV21)和双输入(NV21和纹理)。双输入比单输入少了 NV21转纹理的这步操作,转换性能比较高,但是在低端机上可能出现贴纸不跟脸等情况,建议根据面向的客户来选择合适的接入方式。
5+
6+
> 声网插件云市场上提供了更便捷的集成方式,可以登录声网[控制台](https://console.agora.io/)查看[集成教程](https://console.agora.io/marketplace/license/introduce?serviceName=sensetime-ar)
7+
8+
9+
## 1 商汤美颜SDK
10+
11+
- 联系商汤客服获取最新的sdk下载地址,下载并解压
12+
- 复制**libst_mobile.so****"beauty/sense-time/src/main/jniLibs"** 文件夹下
13+
```
14+
jniLibs
15+
|_ arm64-v8a
16+
|_ armeabi-v7a
17+
```
18+
- 复制**STMobileJNI-release.aar****SenseArSourceManager-release.aar****"beauty/sense-time/libs"** 文件夹下
19+
```
20+
libs
21+
|_ SenseArSourceManager-release.aar
22+
|_ STMobileJNI-release.aar
23+
```
24+
25+
## 2 美颜资源
26+
27+
将SDK里的资源文件复制到**"beauty/sense-time/src/main/assets"** 目录下。这个项目用到的资源文件列举如下:
28+
29+
- 模型资源(必须):在[STRenderer](src/main/java/com/sensetime/effects/STRenderer.java)中加载
30+
models/M_Segment_DBLV2_Pant_1.1.6.model
31+
models/M_SenseME_3DMesh_Face_2.0.2.model
32+
models/M_SenseME_Attribute_1.0.1.model
33+
models/M_SenseME_Avatar_Help_2.2.0.model
34+
models/M_SenseME_CatFace_3.0.0.model
35+
models/M_SenseME_DogFace_2.0.0.model
36+
models/M_SenseME_Face_Extra_Advanced_6.0.13.model
37+
models/M_SenseME_Face_Video_7.0.0.model
38+
models/M_SenseME_Foot_1.0.2.model
39+
models/M_SenseME_Hand_5.4.0.model
40+
models/M_SenseME_Segment_4.14.1.model
41+
models/M_SenseME_Segment_DBL_Face_1.0.7.model
42+
models/M_SenseME_Segment_Hair_1.3.4.model
43+
models/M_SenseME_Segment_Head_1.0.3.model
44+
models/M_SenseME_Segment_MouthOcclusion_FastV1_1.1.3.model
45+
models/M_SenseME_Segment_Skin_1.1.1.model
46+
models/M_SenseME_Segment_Sky_1.0.3.model
47+
48+
- 美妆资源(测试资源):在[BeautySenseTimeImpl](src/main/java/io/agora/beauty/sensetime/BeautySenseTimeImpl.java)中开启美妆时加载
49+
makeup_lip/12自然.zip
50+
51+
- 贴纸(测试资源):在[BeautySenseTimeImpl](src/main/java/io/agora/beauty/sensetime/BeautySenseTimeImpl.java)中开启贴纸时加载
52+
sticker_face_shape/lianxingface.zip
53+
54+
- 滤镜(测试资源):在[BeautySenseTimeImpl](src/main/java/io/agora/beauty/sensetime/BeautySenseTimeImpl.java)中开启滤镜时加载
55+
filter_portrait/filter_style_babypink.model
56+
57+
注意:滤镜资源有时效限制,需要和商汤客服拿到有效的滤镜资源。
58+
59+
## 3 证书
60+
61+
商汤提供了两种证书配置,一种是使用本地lic文件的离线方式,一种是根据applicationId通过商汤接口获取的在线方式。下面说明这两种在项目里的配置方法。
62+
63+
### 3.1 离线模式
64+
- 联系商汤客服获取证书文件,证书文件也有分 **在线/离线** 需要注意
65+
- 如果是离线证书,将证书重命名为**"SenseMe.lic"** ,如果是在线证书则重命名为**"SenseME_Online.lic"** ,然后复制下**"beauty/sense-time/src/main/assets/license"** 文件夹下
66+
-[STLicenseUtils](src/main/java/com/sensetime/effects/utils/STLicenseUtils.java)里的**USING_SERVER_LICENSE**变量设成false
67+
- 要的获取到的证书是否是离线,是离线则将[STLicenseUtils](src/main/java/com/sensetime/effects/utils/STLicenseUtils.java)里的**USING_ASSETS_ONLINE_LICENSE**变量设成false,否则设成true
68+
69+
70+
### 3.2 在线模式
71+
- 联系商汤客服配置应用appId对应的证书
72+
-[STLicenseUtils](src/main/java/com/sensetime/effects/utils/STLicenseUtils.java)里的**USING_SERVER_LICENSE**变量设成true即可
73+
74+
## 4 配置编译
75+
76+
- 将项目目录下**gradle.properties**里的**beauty_sensetime**设置true
77+
- 编译运行
78+

Android/APIExample/beauty/sense-time/README_zh.md

Lines changed: 0 additions & 86 deletions
This file was deleted.

Android/APIExample/beauty/sense-time/src/main/java/com/sensetime/effects/utils/STLicenseUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ public class STLicenseUtils {
2525
//是否使用服务器License鉴权
2626
//true:使用服务器下拉授权文件,使用离线接口生成activeCode
2727
//false: 使用asset文件夹下的 "SenseME.lic","SenseME_Online.lic"生成activeCode
28-
private static final boolean USING_SERVER_LICENSE = true;
28+
private static final boolean USING_SERVER_LICENSE = false;
2929

3030
//是否使用在线鉴权接口,使用SenseME_Online.lic文件
3131
//true: 使用asset文件夹下的"SenseME_Online.lic",使用在线接口generateActiveCodeFromBufferOnline生成activeCode
3232
//false :使用asset文件夹下的"SenseME.lic",使用离线接口generateActiveCodeFromBuffer生成activeCode
33-
private static final boolean USING_ASSETS_ONLINE_LICENSE = false;
33+
private static final boolean USING_ASSETS_ONLINE_LICENSE = true;
3434

3535
private final static String PREF_ACTIVATE_CODE_FILE = "activate_code_file";
3636
private final static String PREF_ACTIVATE_CODE = "activate_code";

Android/APIExample/beauty/sense-time/src/main/java/com/sensetime/effects/view/FilterItem.java

Lines changed: 0 additions & 15 deletions
This file was deleted.

Android/APIExample/beauty/sense-time/src/main/java/com/sensetime/effects/view/MakeupItem.java

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)