Portrait Mode
Overview
When the Portrait Mode is enabled, it applies a Lens that blurs the background behind a person when they are the object of capture in the Camera.

Sample Apps
Sample apps that demonstrate how to implement Portrait Mode and other Camera Kit features are available for you to reference and download on GitHub.
Android Implementation
To implement the Portrait Mode feature in your Android application, use the Android Camera Kit SDK. Before you implement Portrait Mode, please determine whether you are using CameraLayout
and check if the feature is available on your device.
CameraLayout Usage:
-
If you are using CameraLayout, it provides a MutableSet of
AdjustmentsComponent.Adjustments
withPortraitAdjustment
for Portrait Mode. These adjustments are enabled by default on CameraLayout, but you can disable them with:cameraLayout.enabledAdjustments = emptySet()
-
If you are not using CameraLayout, you can apply these adjustments directly on the session object as shown in the following examples.
Check Feature Availability:
-
Some devices may not support Portrait Mode, so you should first check if the feature is available on the device before proceeding with implementation. To check if
PortraitAdjustment
is available:session.adjustments.processor.available(PortraitAdjustment) { available ->
if(available) {
// apply the adjustment
}
}
Adjust Blur Amount:
PortraitAdjustment
provides an image processing algorithm that adds a bokeh-like blur around a person subject. You can adjust the blur amount (float range from 0 to 1):
session.adjustments.processor.apply(PortraitAdjustment) { result ->
result.whenApplied { applied ->
applied.controller.blur = 0.75f
}
}