detect method
Future<R>
detect(
- VisionImage image,
- int rotationDegrees,
- int? timestampMilliseconds, {
- VisionRegionOfInterest? regionOfInterest,
override
Completes with copied results; requests and disposal keep their
submission order. Only the tasks that accept a region of interest
receive regionOfInterest. A browser frame arrives as
image.browserFrame, which the backend releases after inference.
Implementation
@override
Future<R> detect(
VisionImage image,
int rotationDegrees,
int? timestampMilliseconds, {
VisionRegionOfInterest? regionOfInterest,
}) => _submit(
image.browserFrame != null
? {
'bitmap': image.browserFrame,
'width': image.width,
'height': image.height,
'rotation': rotationDegrees,
'timestamp': timestampMilliseconds,
}
: {
'path': image.path == null
? null
: Uri.base.resolve(image.path!).toString(),
'pixels': image.pixels == null
? null
: Uint8List.fromList(image.pixels!).toJS,
'width': image.width,
'height': image.height,
'format': image.format?.name,
'stride': image.bytesPerRow,
'rotation': rotationDegrees,
'timestamp': timestampMilliseconds,
'region': switch (regionOfInterest) {
final r? => [r.left, r.top, r.right, r.bottom],
null => null,
},
},
);