9. Set Contents

Downloaded contents, face beautifications, and face fun bulge effects can be rendered on video frames. These features can be applied or removed through ARGContents class in ARGSession. Types of Contents are defined in ARGContents.h as ARGContentItemType.

<Definition. ARGContentItemType>
typedef NS_ENUM (NSInteger, ARGContentItemType)  {
    ARGContentItemTypeSticker,
    ARGContentItemTypeFilter,
    ARGContentItemTypeBeauty,
    ARGContentItemTypeBulge,
    ARGContentItemTypeNum
};

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

Using the setItemWithType method in the ARGContents Class, you can set an item to be rendered with the the ARGContentItemType, downloaded file, and uuid.

There are several types of items that can be applied in ARGContents as shown below. Currently, the only the contents exist in https://argear.io 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 (Blendshape 52)

The sample code below shows an example of how to set an item.

// Sample Code. An example of setting an ARG Item
/*
 type           ARGContentItemType
 filePath       Contents downloaded path
 itemID         uuid of an iteam
 completion     callback result
 */

ARGSession *argSession = [[ARGSession alloc] initWithARGConfig:argConfig error:&error];

[[argSession contents] setItemWithType:ARGContentItemTypeSticker withItemFilePath:targetPath withItemID:uuid];
 
[[argSession contents] setItemWithType:ARGContentItemTypeSticker
                                    withItemFilePath:targetPath
                                             withItemID:[item uuid]
                                           completion:^( BOOL success, NSString * _Nullable msg) {
        if (success) {
            // success
        } else {
            // fail
        }
}];

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 applying these effects, your customers can transform their faces easily.

Face beautification types are defined in ARGContentItemBeauty type in ARGContents.h. For the details of each parameter type, please refer to the table below.

<Table. Types of ARGContentItemBeauty Description>

ARGContentItemBeauty

Description

Value

ARGContentItemBeautyVline

0

Sharpening Jaw

(V-Line)

Float ( 0 ~ 100 )

Default 0.

100 to the sharpest jaw

ARGContentItemBeautyFaceSlim

1

Reducing Face Width

(Slimmer)

Float ( 0 ~ 100 )

Default 0.

100 to the slimmest face width

ARGContentItemBeautyJaw

2

Shortening Face Height

(Smaller Face)

Float ( 0 ~ 100 )

Default 0.

100 to the shortest face height

ARGContentItemBeautyChin

3

Increasing or Decreasing Chin Length

(Chin Length)

Float ( -100 ~ 100 )

Default 0

-100 to the shortest

100 to the longest

ARGContentItemBeautyEye

4

Increasing Eye Size

(Eye Height)

Float ( 0 ~ 100 )

Default 0.

100 to the biggest

ARGContentItemBeautyEyeGap

5

Increasing or Decreasing the Gap Between Eyes

(Gap between Eyes)

Float ( -100 ~ 100 )

Default 0

-100 to the shortest

100 to the highest

ARGContentItemBeautyNoseLine

6

Sharpening Nose Width

(Nose Width)

Float ( 0 ~ 100 )

Default 0.

100 to the slimmest

ARGContentItemBeautyNoseSize

7

Shortening Width of Nostrils

(Nostrils Width)

Float ( 0 ~ 100 )

Default 0.

100 to the smallest

ARGContentItemBeautyNoseLength

8

Increasing or Decreasing Nose Length

(Nose Length)

Float ( -100 ~ 100 )

Default 0

-100 to the shortest

100 to the longest

ARGContentItemBeautyMouthSize

9

Increasing or Decreasing Mouth Width

(Mouth Width)

Float ( -100 ~ 100 )

Default 0

-100 to the smallest

100 to the largest

ARGContentItemBeautyEyeBack

10

Increasing Back Side of Eyes

(Width of Back Side of Eyes)

Float ( 0 ~ 100 )

Default 0.

100 to the longest

ARGContentItemBeautyEyeCorner

11

Increasing or Decreasing Degree of Eyes

(Degree of Eyes)

Float ( -100 ~ 100 )

Default 0

-100 to the lowest

100 to the highest

ARGContentItemBeautyLipSize

12

Increasing or Decreasing Height Thickness of Lips

(Thickness of Lips)

Float ( -100 ~ 100 )

Default 0

-100 to the thinnest

100 to the thickest

ARGContentItemBeautySkinFace

13

Hiding Facial Blemish

(Facial Blemish Removal)

Float ( 0 ~ 100 )

Default 0.

100 to the cleanest

ARGContentItemBeautySkinDarkCircle 14

Hiding Dark Circles

(Dark Circles Removal)

Float ( 0 ~ 100 )

Default 0.

100 to the cleanest

ARGContentItemBeautySkinMouthWrinkle

15

Hiding Mouth Wrinkles

(Mouth Wrinkles Removal)

Float ( 0 ~ 100 )

Default 0.

100 to the cleanest

9.2.1 Enable Face Beautification

The sample code below shows how to enable face beautification effects.

// Sample Code. Enabling Face Beautification

ARGSession *argSession = [[ARGSession alloc] initWithARGConfig:argConfig error:&error];
 
[[argSession.contents] setBulge:ARGContentItemBulgeNONE];
[[argSession contents] setDefaultBeauty];

9.2.2 Face Beautification Effects Manipulation

By setting beauty values, you can change the amount face beautification effects are applied.

The sample code below shows how to manipulate one or multiple face beautification effects.

// Sample Code. Manipulating Face Beautification Effects

ARGSession *argSession = [[ARGSession alloc] initWithARGConfig:argConfig error:&error];

 
// Set a Specific Face Beautification Effect Level
[[argSession contents] setBeauty:ARGContentItemBeautyFaceSlim value:0.7f];
 
 
// Set 16 Face Beautification Effects at the Same Time
float beautyValue[BEAUTY_TYPE_NUM];
    
defaultValue[BEAUTY_TYPE_VLINE] = 10.f;
defaultValue[BEAUTY_TYPE_FACE_SLIM] = 90.f;
defaultValue[BEAUTY_TYPE_JAW] = 55.f;
defaultValue[BEAUTY_TYPE_CHIN] = -50.f;
defaultValue[BEAUTY_TYPE_EYE] = 5.f;
defaultValue[BEAUTY_TYPE_EYE_GAP] = -10.f;
defaultValue[BEAUTY_TYPE_NOSE_LINE] = 0.f;
defaultValue[BEAUTY_TYPE_NOSE_SIDE] = 35.f;
defaultValue[BEAUTY_TYPE_NOSE_LENGTH] = 30.f;
defaultValue[BEAUTY_TYPE_MOUTH_SIZE] = -35.f;
defaultValue[BEAUTY_TYPE_EYE_BACK] = 0.f;
defaultValue[BEAUTY_TYPE_EYE_CORNER] = 0.f;
defaultValue[BEAUTY_TYPE_LIP_SIZE ] = 0.f;
defaultValue[BEAUTY_TYPE_SKIN_FACE] = 50.f;
defaultValue[BEAUTY_TYPE_SKIN_DARK_CIRCLE ] = 0.f;
defaultValue[BEAUTY_TYPE_SKIN_MOUTH_WRINKLE ] = 0.f;
    
[[argSession contents] setBeautyValues:beautyValue];

9.3 Face Fun Bulge

The setBulge function in ARGContents class allows you to set 6 types of fun bulge effects.

Sample code of fun bulge is written below.

// Sample Code. Set Face Bulge Fun Type

ARGSession *argSession = [[ARGSession alloc] initWithARGConfig:argConfig error:&error];

 
[[argSession contents] setBulge:1];

9.4 Remove Contents

By calling clear method with the ARGContentItemType in ARContents Class, related contents can be removed.

Sample code is written below.

// Sample Code. Removing Contents Example

ARGSession *argSession = [[ARGSession alloc] initWithARGConfig:argConfig error:&error];

 
[[argSession contents] clear:ARGContentItemTypeSticker];

Last updated