B4A Library [B4X] SelfieSegmentation with ML Kit

1717424669041.png

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: 293
Last edited:

Cesaral

Member
I get the linking error:

B4A Versión: 13.40
Parseando código. (0.21s)
Java Versión: 11
Building folders structure. (0.05s)
Corriendo accion personalizada. (0.09s)
Compilando código. (0.38s)
Compilado códigos de diseños. (0.07s)
Organizando librerías. (7.69s)
(AndroidX SDK)
Compilando los recursos (2.08s)
Enlazando los recursos Error
res\values-v20\theme.xml:6: error: style attribute 'android:attr/windowOptOutEdgeToEdgeEnforcement' not found.
error: failed linking references.

I think I followed all the steps mentioned.

Please help!
 
Top