Agora provides an image enhancement API for users in social and entertainment scenarios to improve their appearance in a video call or interactive live video streaming. With this API, users can adjust settings such as the image contrast, brightness, sharpness, and red saturation, as shown in the following figure.
Before proceeding, ensure that you have implemented basic real-time functions in your project. See Start a Call or Start Live Interactive Streaming for details.
Call the setBeautyEffectOptions
method to flexibly add image enhancement features.
This method has two parameters:
enabled
: sets whether or not to enable image enhancement.options
: sets the image enhancement options, including lighteningContrastLevel
for adjusting the contrast level, lightening
for adjusting the brightness level, smoothness
for adjusting the sharpness level, and redness
for adjusting the red saturation level.//swift
let options = AgoraBeautyOptions()
options.lighteningContrastLevel = .normal
options.rednessLevel = 0
options.smoothnessLevel = 0
options.lighteningLevel = 0
agoraKit.setBeautyEffectOptions(true, options: options)
//objective-c
AgoraBeautyOptions *options = [[AgoraBeautyOptions alloc] init];
options.lighteningContrastLevel = AgoraLighteningContrastNormal;
options.rednessLevel = 0;
options.smoothnessLevel = 0;
options.lighteningContrastLevel = 0;
[self.agoraKit setBeautyEffectOptions:YES options:options];
We also provide open-source demo projects that implement image enhancement on GitHub. You can try the demo and view the source code.
RoomViewController.swift
.RoomViewController.m
.