We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.
We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.
We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.
We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.
Portrait segmentation refers to the separation of the portrait subject and background in an image. The portrait subject and background are divided into different sections distinguished by tags. The API demonstrates portrait segmentation in the image, and the segmentation results are displayed separately as the portrait and background.
Scenarios
Smart image enhancement, background editing
This API separates the portrait subject from the background in images, and is particularly relevant for background replacement, rendering, and blurring.
Background replacement
Image backgrounds are replaced, based on the segmentation results. For example, the background scenery in a portrait shot, can be replaced with another scene.
Background blurring
Image backgrounds are blurred based on the segmentation results, for a more aesthetically-pleasing effect.
Description
Request
Copy
SegmentationConfiguration sc = new SegmentationConfiguration();
sc.setSegmentationType
(SegmentationConfiguration.TYPE_PORTRAIT);
ImageSegmentation ssEngine = new ImageSegmentation(mContext);
1Can I call the faceCompare() method without calling the prepare() method of the API?
Yes, you can. The engine is started by default in the faceCompare() method. If the engine has already been started, it will not restart.
2When should I call the release() method?
The release() method will uninstall a model that has been loaded to the NPU chip. If the app is no longer using face detection, uninstall the model in a timely manner to free up resources.