9. Set Contents
You can set downloaded contents (items, face beautifications, and bulges) through ARGear using the methods in the ARGContents class.

9.1 An Item (2D/3D Sticker, Filter, Background, ARContents, …)

The setItem function in the ARGContents class allows you to set an item on frames.
There are several types of items that can be set in ARGContents as shown below. Currently, the contents that exist in https://argear.io only can be used in ARGContents.
    2D Animation Sticker / Effects (BGM Support)
    2D Face Mask
    Face Fun Bulge
    Face Beautification
    Camera Filter
    3D Animation Sticker
    Realtime Segmentation
    3D Avatar (Blendshapes: 52)
The sample code below shows an example of how to set an item.
Java
Kotlin
1
/**
2
* @param type contents type : ARGContents.Type.ARGItem, ARGContents.Type.FilterItem
3
* @param path downloaded contents path
4
* @param uuid uuid of an item
5
*/
6
argsession.contents().setItem(type, path, uuid, new ARGContents.Callback() {
7
8
@Override
9
public void onSuccess() {
10
11
}
12
13
@Override
14
public void onError(Throwable e) {
15
if (e instanceof InvalidContentsException) {
16
Log.e(TAG, "InvalidContentsException");
17
}
18
}
19
20
});
Copied!
1
/**
2
* @param type contents type : ARGContents.Type.ARGItem, ARGContents.Type.FilterItem
3
* @param path downloaded contents path
4
* @param uuid uuid of an item
5
*/
6
argsession.contents().setItem(type, path, itemModel.uuid, object : ARGContents.Callback {
7
override fun onSuccess() {
8
9
}
10
11
override fun onError(e: Throwable) {
12
if (e is InvalidContentsException) {
13
Log.e(TAG, "InvalidContentsException")
14
}
15
}
16
})
17
Copied!

9.2 Apply Face Beautification Effect

There are 16 face beautification effects in ARGContents such as V-line, face slim, jaw, chin, eye, eye gap, nose line, nose side, nose length, mouth size, eye back, eye corner, lip size, face skin, dark circle, and lip wrinkle. By setting these effects, your customers can transform their faces easily.
By using the setBeauty function in ARGContents class, you can easily add such functionalities without relying on the CMS module. Each face beautification type requires a float array as its input to determine how much of a face beautification effect should be applied.
The tables below describe detailed information for each type of face beautification effect.
ARGContents.BeautyType
Description
Value
VLINE
0
Sharpening Jaw
(V-Line)
Float ( 0 ~ 100 )
Default 0.
100 to the sharpest jaw
FACE_SLIM
1
Reducing Face Width
(Slimmer)
Float ( 0 ~ 100 )
Default 0.
100 to the slimmest face width
JAW
2
Shortening Face Height
(Smaller Face)
Float ( 0 ~ 100 )
Default 0.
100 to the shortest face height
CHIN
3
Increasing or Decreasing Chin Length
(Chin Length)
Float ( -100 ~ 100 )
Default 0.
-100 to the shortest
100 to the longest
EYE
4
Increasing Eye Size
(Eye Height)
Float ( 0 ~ 100 )
Default 0.
100 to the biggest
EYE_GAP
5
Increasing or Decreasing the Gap Between Eyes
(Gap between Eyes)
Float ( -100 ~ 100 )
Default 0.
-100 to the shortest
100 to the highest
NOSE_LINE
6
Sharpening Nose Width
(Nose Width)
Float ( 0 ~ 100 )
Default 0.
100 to the slimmest
NOSE_SIDE
7
Shortening Width of Nostrils
(Nostrils Width)
Float ( 0 ~ 100 )
Default 0.
100 to the smallest
NOSE_LENGTH
8
Increasing or Decreasing Nose Length
(Nose Length)
Float ( -100 ~ 100 )
Default 0.
-100 to the shortest
100 to the longest
MOUTH_SIZE
9
Increasing or Decreasing Mouth Width
(Mouth Width)
Float ( -100 ~ 100 )
Default 0.
-100 to the smallest
100 to the largest
EYE_BACK
10
Increasing Back Side of Eyes
(Width of Back Side of Eyes)
Float ( 0 ~ 100 )
Default 0.
100 to the longest
EYE_CORNER
11
Increasing or Decreasing Degree of Eyes
(Degree of Eyes)
Float ( -100 ~ 100 )
Default 0.
-100 to the lowest
100 to the highest
LIP_SIZE
12
Increasing or Decreasing Height Thickness of Lips
(Thickness of Lips)
Float ( -100 ~ 100 )
Default 0.
-100 to the thinnest
100 to the thickest
SKIN_FACE
13
Hiding Facial Blemish
(Facial Blemish Removal)
Float ( 0 ~ 100 )
Default 0.
100 to the cleanest
SKIN_DARK_CIRCLE 14
Hiding Dark Circles
(Dark Circles Removal)
Float ( 0 ~ 1 00)
Default 0.
100 to the cleanest
SKIN_MOUTH_WRINKLE
15
Hiding Mouth Wrinkles
(Mouth Wrinkles Removal)
Float ( 0 ~ 100 )
Default 0.
100 to the cleanest
Below is sample code of applying face beautification effects:
Java
Kotlin
1
public float[] beautyValues = {
2
10, //VLINE
3
90, //ACE_SLIM
4
55, //JAW
5
-50, //CHIN
6
5, //EYE
7
-10, //EYE_GAP
8
0, //NOSE_LINE
9
35, //NOSE_SIDE
10
30, //NOSE_LENGTH
11
-35, //MOUTH_SIZE
12
0, //EYE_BACK
13
0, //EYE_CORNER
14
0, //LIP_SIZE
15
50, //SKIN
16
0, //DARK_CIRCLE
17
0, //MOUTH_WRINKLE
18
};
19
20
argsession.contents().setBeauty(beautyValues);
Copied!
1
val beautyValues = floatArrayOf(
2
10, //VLINE
3
90, //ACE_SLIM
4
55, //JAW
5
-50, //CHIN
6
5, //EYE
7
-10, //EYE_GAP
8
0, //NOSE_LINE
9
35, //NOSE_SIDE
10
30, //NOSE_LENGTH
11
-35, //MOUTH_SIZE
12
0, //EYE_BACK
13
0, //EYE_CORNER
14
0, //LIP_SIZE
15
50, //SKIN
16
0, //DARK_CIRCLE
17
0, //MOUTH_WRINKLE
18
)
19
20
argsession.contents().setBeauty(beautyValues)
Copied!

9.3 Face Fun Bulge

The setBulge function in ARGContents class allows you to set 6 types of face fun bulge effects.
Sample code of face fun bulge is written below.
Java
Kotlin
1
/**
2
* @param type ARGContents.BulgeType.FUN1
3
* ARGContents.BulgeType.FUN2
4
* ARGContents.BulgeType.FUN3
5
* ARGContents.BulgeType.FUN4
6
* ARGContents.BulgeType.FUN5
7
* ARGContents.BulgeType.FUN6
8
*/
9
argsession.contents().setBulge(type);
Copied!
1
/**
2
* @param type ARGContents.BulgeType.FUN1
3
* ARGContents.BulgeType.FUN2
4
* ARGContents.BulgeType.FUN3
5
* ARGContents.BulgeType.FUN4
6
* ARGContents.BulgeType.FUN5
7
* ARGContents.BulgeType.FUN6
8
*/
9
argsession.contents().setBulge(type)
Copied!

9.4 Remove Contents

The clear function in ARGContents class can remove all the applied contents of a specified type.
Sample code is written below.
Java
Kotlin
1
/**
2
* @param type ARGContents.Type.ARGItem
3
* ARGContents.Type.FilterItem
4
* ARGContents.Type.Beauty
5
* ARGContents.Type.Bulge
6
*/
7
argsession.contents().clear(type);
Copied!
1
/**
2
* @param type ARGContents.Type.ARGItem
3
* ARGContents.Type.FilterItem
4
* ARGContents.Type.Beauty
5
* ARGContents.Type.Bulge
6
*/
7
argsession.contents().clear(type)
Copied!
Last modified 1yr ago