DetectionWithSegmentationResult class
Result combining face detection and segmentation from parallel processing.
This class bundles the results of running face detection and selfie segmentation simultaneously in separate isolates. Use with FaceDetectorIsolate.detectFacesWithSegmentation for optimal performance when both features are needed.
Example
final detector = await FaceDetectorIsolate.spawn(withSegmentation: true);
final result = await detector.detectFacesWithSegmentation(mat);
print('Found ${result.faces.length} faces');
print('Mask: ${result.segmentationMask?.width}x${result.segmentationMask?.height}');
print('Total time: ${result.totalTimeMs}ms (parallel processing)');
Performance
When using parallel processing, totalTimeMs represents the maximum of detectionTimeMs and segmentationTimeMs, rather than their sum. This typically results in 40-50% faster processing compared to sequential calls.
Constructors
-
DetectionWithSegmentationResult({required List<
Face> faces, SegmentationMask? segmentationMask, required int detectionTimeMs, required int segmentationTimeMs}) -
Creates a result combining detection and segmentation outputs.
const
-
DetectionWithSegmentationResult.fromMap(Map<
String, dynamic> map) -
Creates a result from a serialized map.
factory
Properties
- detectionTimeMs → int
-
Time taken for face detection in milliseconds.
final
-
faces
→ List<
Face> -
Detected faces with landmarks, mesh, and iris data.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- segmentationMask → SegmentationMask?
-
Segmentation mask separating foreground (person) from background.
final
- segmentationTimeMs → int
-
Time taken for segmentation in milliseconds.
final
- totalTimeMs → int
-
Total processing time in milliseconds.
no setter
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toMap(
) → Map< String, dynamic> - Serializes this result to a map for isolate transfer.
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited