FaceUnity AR Filter

Updated

Integrate and use the FaceUnity AR Filter extension in your Android, iOS, or Flutter app.

The FaceUnity AR Filter extension uses 3D vision, 3D graphics, and deep learning technologies to provide advanced AR portrait video effects for the Agora Video SDK. It enables features such as:

  • Basic beauty: Skin beautification, whitening, and rosy effects.
  • Advanced beauty: Beauty effects for shape, face, and skin.
  • Number detection: Detect the number of faces, humans, or gestures.

This page shows you how to integrate and use the FaceUnity AR Filter extension in your app.

Understand the tech

In a Flutter project, you integrate the native Android and iOS plug-ins through Gradle and CocoaPods respectively.

Prerequisites

Project setup

  1. Integrate the Android plugin through Gradle by adding the downloaded .aar files to android/libs and configuring build.gradle.

  2. Integrate the iOS plugin through CocoaPods by importing the .framework files and updating the podspec and Podfile.

  3. Convert the authpack certificate to Dart and save it in the Flutter lib folder.

  4. Save the required model and .bundle files from the resource package to the project folder.

  5. Add the necessary Flutter dependencies and assets to pubspec.yaml.

Integrate the extension

Enable the extension

if (Platform.isAndroid) {
  await agoraEngine.loadExtensionProvider(path: 'AgoraFaceUnityExtension');
}

await agoraEngine.enableExtension(
  provider: "FaceUnity",
  extension: "Effect",
  enable: true,
);

Handle extension callbacks

Register onExtensionStarted, onExtensionError, and onExtensionEvent in RtcEngineEventHandler.

Initialize the extension

Call setExtensionProperty to set fuSetup and fuLoadAIModelFromPackage.

Apply AR effects

Call setExtensionProperty to load props and apply effects such as the cat ears demo effect.

Release resources

Call setExtensionProperty with fuDestroyLibData when you dispose of the engine.

Reference