google_mlkit_selfie_segmentation
1.0.3, released 8 days ago by flutter-ml.dev
Flutter plugin to use Google's ML Kit Selfie Segmentation API.
What it does
A Flutter plugin that uses Google's ML Kit Selfie Segmentation API to separate the background from users within a scene. It passes calls via platform channels to native iOS and Android APIs, returning segmentation masks with confidence scores.
AI-written summary of version 1.0.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to separate users from backgrounds in selfies or video streams on Android and iOS.
- You want to leverage on-device machine learning for real-time segmentation.
Skip it when
- You are targeting web or desktop platforms.
- You require custom model training or custom architecture beyond Google's pre-built selfie segmentation.
Strengths
- Leverages optimized native Google ML Kit APIs.
- Supports both single images and stream modes with configurable options.
Weaknesses
- Mobile only (Android and iOS); web or other platforms are not supported.
- Running segmentation inference on Apple Silicon iOS simulators requires physical hardware or specific setup limitations.
Setup
- Kind
- Plugin (native code)
- Effort
- High
- Code generation
- No
- Direct dependencies
- 1
Requires setting minimum iOS deployment target to 15.0, configuring Xcode linker flags (-ObjC and -all_load), downloading ML Kit resource bundles manually via Swift Package Manager setup, and configuring Android minimum SDK to 21 with compileSdk 36.
final segmenter = SelfieSegmenter(
mode: SegmenterMode.stream,
enableRawSizeMask: true,
);
final SegmentationMask? mask = await segmenter.processImage(inputImage);
segmenter.close();Alternatives
Packages that do the same job and could replace google_mlkit_selfie_segmentation.
- native_cutout
On-device background removal for iOS and Android using native vision and segmentation APIs.
59Compare
Works with
Packages commonly used together with google_mlkit_selfie_segmentation: ones it builds on, ones built on it, and its own family.
- google_mlkit_commonsgoogle_mlkit_selfie_segmentation depends on itCommon classes and utility methods for Google's ML Kit plugins
- google_mlkit_text_recognitionSame familyFlutter plugin to use Google's ML Kit Text Recognition on Android and iOS.
- google_mlkit_barcode_scanningSame familyA Flutter plugin to use Google's ML Kit Barcode Scanning on Android and iOS.
- google_mlkit_face_detectionSame familyFlutter plugin to use Google's ML Kit Face Detection on iOS and Android.
- google_mlkit_translationSame familyFlutter plugin for Google's ML Kit On-Device Translation.
- google_mlkit_language_idSame familyDetermine the language of a text string using Google's ML Kit.
- google_mlkit_pose_detectionSame familyFlutter plugin for Google ML Kit Pose Detection on Android and iOS.
- google_mlkit_document_scannerSame familyFlutter plugin to use Google's ML Kit document scanner API to digitize physical documents.