B4A Library [B4X] SelfieSegmentation with ML Kit


Image source: https://en.wikipedia.org/wiki/Selfie#/media/File:TWC_Hokitika_Gorge_•_Stewart_Nimmo_•_MRD_1.jpg

A B4A + B4i selfie segmentation feature based on Google ML Kit: https://developers.google.com/ml-kit/vision/selfie-segmentation
The result is a mask image. In the example it is overlayed over the original image using a semitransparent B4XImageView.

Usage itself is quite straightforward. See the example.
The configuration is a bit cumbersome.
Please go over the dependencies sections in the text recognition tutorial: https://www.b4x.com/android/forum/threads/b4x-textrecognition-based-on-mlkit.161210/#content

Don't miss:
- B4i dependencies + #PlistExtra (for MediaChooser) in Main module.
- B4i bundle files under Files\Special.
- B4A dependencies in Main module.
- B4A manifest editor. Snippets for MLKit and snippet for FileProvider (MediaChooser).
 

Attachments

  • SelfieSegmentation.zip
    393 KB · Views: 104
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…