getCameraImagePredictionList method
Future<List<ResultObjectDetection> >
getCameraImagePredictionList(
- CameraImage cameraImage, {
- int? rotation,
- double minimumScore = 0.5,
- double iOUThreshold = 0.5,
- int boxesLimit = 10,
- CameraPreProcessingMethod cameraPreProcessingMethod = CameraPreProcessingMethod.imageLib,
- PreProcessingMethod preProcessingMethod = PreProcessingMethod.imageLib,
Retrieves a list of ResultObjectDetection by predicting the objects in the given cameraImage.
The rotation parameter specifies the rotation of the camera image.
The optional parameters minimumScore, iOUThreshold, boxesLimit, cameraPreProcessingMethod, and preProcessingMethod
allow customization of the prediction process.
Implementation
Future<List<ResultObjectDetection>> getCameraImagePredictionList(
CameraImage cameraImage,
{int? rotation,
double minimumScore = 0.5,
double iOUThreshold = 0.5,
int boxesLimit = 10,
CameraPreProcessingMethod cameraPreProcessingMethod =
CameraPreProcessingMethod.imageLib,
PreProcessingMethod preProcessingMethod =
PreProcessingMethod.imageLib}) async {
if (cameraPreProcessingMethod == CameraPreProcessingMethod.imageLib) {
// Convert the camera image to bytes using ImageUtilsIsolate
Uint8List? bytes =
await ImageUtilsIsolate.convertCameraImageToBytes(cameraImage);
if (bytes == null) {
throw Exception("Unable to process image bytes");
}
// Get the image prediction list using the converted bytes
return await getImagePredictionList(bytes,
minimumScore: minimumScore,
iOUThreshold: iOUThreshold,
boxesLimit: boxesLimit,
preProcessingMethod: preProcessingMethod);
}
// Get the image prediction list directly from the camera image planes
return await getImagePredictionFromBytesList(
cameraImage.planes.map((e) => e.bytes).toList(),
cameraImage.width,
cameraImage.height,
minimumScore: minimumScore,
iOUThreshold: iOUThreshold,
boxesLimit: boxesLimit);
}