Introduction

Agora provides an image enhancement API for users in social and entertainment scenarios to improve their appearance in video calls or live broadcasts. With this API, users can adjust settings such as the image contrast, brightness, sharpness, and red saturation, as shown in the following figure:

Implementation

Before proceeding, ensure that you implement a basic call or live broadcast in your project. See Start a Call or Start a Live Broadcast 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.

Sample code

mRtcEngine.setBeautyEffectOptions(true, new BeautyOptions(LIGHTENING_CONTRAST_NORMAL, 0.5F, 0.5F, 0.5F));

We also provide an open-source OpenVideoCall-Android demo project that implements image enhancement on GitHub. You can go to the repository to download it. You can try the demo and refer to the source code in the WorkerThread.java and CallActivity.java files.

Considerations

  • This API method has return values. If the method call fails, the return value is < 0.
  • For low-end phones, enabling image enhancement affects the system performance. When the video resolution is set as 360p, 720p or higher, and the frame rate is set as 30 fps or 15 fps, do not enable image enhancement.