ZEGOCLOUD’s SDKs provide basic face beautification features such as skin tone enhancement, skin smoothing, cheek blusher, and image sharpening, which are commonly used in video calls and live streaming scenarios, making you look the way you want.
You can enable the basic face beautification features based on your needs and set the intensity as wanted.
The basic face beautification features listed in this document (skin tone enhancement, cheek blusher, skin smoothing, and image sharpening) are provided by the embedded AI Effects SDK in the ZEGOCLOUD Video Call SDK. For more advanced beautification features, see Add video filters with the AI Effects.
Before you begin, make sure:
To use the basic face beautification features, call the startEffectsEnv method to initialize the face beautification environment before starting the local video view (startPreview) and publishing streams (startPublishingStream).
After initializing the face beautification environment, the SDK implements the transmission with the default video frame data type. If you need to use the custom video pre-processing feature, you will need to configure the corresponding video frame data type:
bufferType of the ZegoCustomVideoCaptureConfig to ZEGO_VIDEO_BUFFER_TYPE_RAW_DATA.CVPixelBuffer type. That is, you must set the bufferType of the ZegoCustomVideoCaptureConfig to ZegoVideoBufferTypeCVPixelBuffer.Texture 2D type. That is, you must set the bufferType of the ZegoCustomVideoCaptureConfig to GL_TEXTURE_2D. /** Create a face beautification environment */
[[ZegoExpressEngine sharedInstance] startEffectsEnv];
There is no particular time order for calling the enableEffectsBeauty method and the setEffectsBeautyParam method.
After initializing the face beautification environment, you can call the enableEffectsBeauty method to enable the face beautification feature you want to use after or before the stream publishing.
/** Enable the basic face beautification features */
[[ZegoExpressEngine sharedInstance] enableEffectsBeauty:true];
After initializing the face beautification environment, you can call the setEffectsBeautyParam method to set the intensity as needed after or before the stream publishing.
The value range for the four features is [0, 100], and the default value is 50. As this value gets larger, the intensity gets stronger.
// Create a parameter object for the face beautification environment.
ZegoEffectsBeautyParam *beautyParam = [[ZegoEffectsBeautyParam alloc] init];
// Skin tone enhancement, cheek blusher, skin smoothing, image sharpening
beautyParam.whitenIntensity = 50;
beautyParam.rosyIntensity = 50;
beautyParam.smoothIntensity = 50;
beautyParam.sharpenIntensity = 50;
/** Set the intensity by specifying the parameter */
[[ZegoExpressEngine sharedInstance] setEffectsBeautyParam:beautyParam];
To disable the face beautification features, set the parameter to false when calling the enableEffectsBeauty method. While the face beautification module still occupies resources.
To destroy the face beautification environment and release the resources it occupies, call the stopEffectsEnv method before the local video preview and stream publishing.
The SDK automatically destroys the face beautification environment when you call the destroyEngine method to destroy the SDK.
/** Destroy the face beautification environment */
[[ZegoExpressEngine sharedInstance] stopEffectsEnv];
