MeiCam SDK For iOS  3.7.2
Usage Method of Human Face Detection Effect

The Usage Method of Human Face Detection Effect for the Meishe SDK is used as follows:

1.Initializes AR Face,it only need to be initialized once. NvsFaceEffectV1 is a face effect class of SDK, "NvFaceData.bundle" is a kind of face data file package,and "authpack.h" is a authorization header file(g_auth_package is a static array in the authorization header file). The function of SetMaxFaces: can set the max count of face detection after starting detecting. It can detect up to 8 faces at the same time,the default is 1 face. Initialization codes are as follows:

        NSString *strBundlePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"NvFaceData.bundle"];
        [NvsFaceEffectV1 InitFaceEffectV1:strBundlePath authPackage:&g_auth_package authSize:sizeof(g_auth_package)];
        [NvsFaceEffectV1 SetMaxFaces:1];

2.Adds the face effect with name of "Face Effect". By default, it has the beauty. The revelant codes are as follows:

        _fxARFace = [_context appendBuiltinCaptureVideoFx:@"Face Effect"];
        NSString *strBeautyPath = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"NvBeautification.bundle"];
        [_fxARFace setStringVal:@"Beautification Package" val:strBeautyPath];
  1. Sets the face prop for face effect. The codes are as follows:
         NSString *strItemBundlePath = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"items"];
         strItemBundlePath = [strItemBundlePath stringByAppendingPathComponent:packageName];//"packageName" is a prop package with the suffix .bundle.
         [_fxARFace setStringVal:@"Face Ornament" val:strItemBundlePath];
    

4.Choose the type of face shape, including the default, goddess, internet celebrity and natural. Users can choose one of them when capturing. The corresponding codes are as follows:

        [_fxARFace setMenuVal:@"Face Type" val:@"Default"];           //Default
        [_fxARFace setMenuVal:@"Face Type" val:@"Goddness"];          //Goddess 
        [_fxARFace setMenuVal:@"Face Type" val:@"Internet Celebrity"];//Internet celebrities 
        [_fxARFace setMenuVal:@"Face Type" val:@"Natural"];           //Natural

5.Sets parameters for each face type, including "Face Shape Level", "Eye Enlarging" and "Cheek Thinning". The corresponding code is as follows:

        [_fxARFace setFloatVal:@"Face Shape Level" val:slider.value]; //Specifies the basic face shape level.
        [_fxARFace setFloatVal:@"Cheek Thinning" val:slider.value];   //Eye enlarging for controlling the size of eyes.
        [_fxARFace setFloatVal:@"Eye Enlarging" val:slider.value];    //Face thinning for adjusting the size of face.

6.After using, please destroy the face effect. The codes are as follows:

                    [NvsFaceEffectV1 done];