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.

/**
 * @param type   contents type  : ARGContents.Type.ARGItem,  ARGContents.Type.FilterItem
 * @param path   downloaded contents path
 * @param uuid   uuid of an item
 */
argsession.contents().setItem(type, path, uuid, new ARGContents.Callback() {

    @Override
    public void onSuccess() {

    }

    @Override
    public void onError(Throwable e) {
        if (e instanceof InvalidContentsException) {
            Log.e(TAG, "InvalidContentsException");
        }
    }

});

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:

public float[] beautyValues = {
        10,     //VLINE
        90,     //ACE_SLIM
        55,     //JAW
        -50,    //CHIN
        5,      //EYE
        -10,    //EYE_GAP
        0,      //NOSE_LINE
        35,     //NOSE_SIDE
        30,     //NOSE_LENGTH
        -35,    //MOUTH_SIZE
        0,      //EYE_BACK
        0,      //EYE_CORNER
        0,      //LIP_SIZE
        50,     //SKIN
        0,      //DARK_CIRCLE
        0,      //MOUTH_WRINKLE
};

argsession.contents().setBeauty(beautyValues);

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.

/**
 * @param type   ARGContents.BulgeType.FUN1
 *               ARGContents.BulgeType.FUN2 
 *               ARGContents.BulgeType.FUN3 
 *               ARGContents.BulgeType.FUN4 
 *               ARGContents.BulgeType.FUN5 
 *               ARGContents.BulgeType.FUN6 
 */
argsession.contents().setBulge(type);

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.

/**
 * @param type   ARGContents.Type.ARGItem
 *                          ARGContents.Type.FilterItem 
 *                          ARGContents.Type.Beauty 
 *                          ARGContents.Type.Bulge 
 */
argsession.contents().clear(type);

Last updated