logo
On this page

Basic AI Effects

2024-01-02

Function Overview

ZEGO provides basic AI effects features to present good skin condition for users and create unique natural beauty effects. This feature is commonly used in video calls, live streaming, and other scenarios.

Developers can enable the AI effects switch, and then adjust the degree of whitening, smoothing, sharpening, and rosiness as needed to easily implement basic AI effects features.

Prerequisites

Before implementing AI effects features, please ensure:

Usage Steps

Initialize Basic AI Effects Environment

If you need to use basic AI effects features, you must call the StartEffectsEnv interface to initialize the AI effects environment before starting preview with StartPreview or publishing stream with StartPublishingStream.

// Create AI effects environment
engine.StartEffectsEnv();

Enable/Disable Basic AI Effects Effects

Note

There is no order requirement for calling the EnableEffectsBeauty interface and the SetEffectsBeautyParam interface.

After initializing the AI effects environment, you can call the EnableEffectsBeauty interface before or after publishing stream to enable or disable AI effects effects in real time.

// Enable/disable AI effects effects
engine.EnableEffectsBeauty(true);

Set Basic AI Effects Effect Parameters

After initializing the AI effects environment, you can call the SetEffectsBeautyParam interface before or after publishing stream to set AI effects effect parameters in real time.

  • smoothIntensity: Smoothing, performs smoothing while retaining facial details, such as retaining moles on the face.
  • whitenIntensity: Whitening, whitens the face by increasing the overall brightness of the image.
  • rosyIntensity: Rosiness, applies warm color processing to the overall image.
  • sharpenIntensity: Sharpening, applies sharpening processing to the overall image. When the image is slightly blurry, you can slightly increase sharpening to make contours clear.

The value range of all four parameters above is 0 to 100. The larger the value, the higher the AI effects degree. The default value is 50.

ZegoEffectsBeautyParam beautyParam = new ZegoEffectsBeautyParam();

// Whitening, rosiness, smoothing, sharpening
beautyParam.whitenIntensity = 50;
beautyParam.rosyIntensity = 50;
beautyParam.smoothIntensity = 50;
beautyParam.sharpenIntensity = 50;

engine.SetEffectsBeautyParam(beautyParam);

Destroy Basic AI Effects Environment

When the EnableEffectsBeauty interface is called and set to "false", the AI effects effects will be turned off, but the AI effects module will still occupy resources and consume performance. If you want to completely release resources and save performance consumption, you need to call the StopEffectsEnv interface to destroy the AI effects environment before preview and publishing stream.

Note

When DestroyEngine is called to destroy the engine, the SDK will automatically destroy the AI effects environment.

// Destroy AI effects environment
engine.StopEffectsEnv();

Previous

Getting Audio Raw Data

Next

Screen Sharing

On this page

Back to top