DetectedObject class
A single detected object with bounding box and category.
Mirrors MediaPipe's Detection class for the Object Detector solution.
Example:
final detections = await detector.detect(imageBytes);
for (final obj in detections) {
final box = obj.boundingBox;
final cat = obj.categories.first;
print('Found ${cat.categoryName} (${(cat.score * 100).toStringAsFixed(1)}%) '
'at (${box.topLeft.x.toInt()}, ${box.topLeft.y.toInt()})');
}
Constructors
-
DetectedObject({required Detection detection, required List<
Category> categories, required Size originalSize}) - Creates a detected object with the given detection, categories, and image size.
-
DetectedObject.fromMap(Map<
String, dynamic> map) -
Creates a DetectedObject from a serialized map.
factory
Properties
- boundingBox → BoundingBox
-
The detected object's bounding box in pixel coordinates.
final
-
categories
→ List<
Category> -
All category predictions for this detection.
final
- category → Category
-
The top-1 category for this detection (highest score).
no setter
- categoryName → String
-
Convenience accessor for the top-1 category's name.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- originalSize → Size
-
Dimensions of the original source image.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- score → double
-
Convenience accessor for the top-1 category's score.
no setter
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toMap(
) → Map< String, dynamic> - Serializes this detection for isolate transfer.
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited