first commit

This commit is contained in:
Abdullah Salah
2024-12-25 11:09:55 +03:00
commit 216efb8a83
125 changed files with 6752 additions and 0 deletions

View File

@ -0,0 +1,47 @@
import 'package:camerawesome/camerawesome_plugin.dart';
import 'package:google_mlkit_commons/google_mlkit_commons.dart';
extension MLKitUtils on AnalysisImage {
InputImage toInputImage() {
return when(
nv21: (image) {
return InputImage.fromBytes(
bytes: image.bytes,
metadata: InputImageMetadata(
rotation: inputImageRotation,
format: InputImageFormat.nv21,
size: image.size,
bytesPerRow: image.planes.first.bytesPerRow,
),
);
},
bgra8888: (image) {
return InputImage.fromBytes(
bytes: image.bytes,
metadata: InputImageMetadata(
size: size,
rotation: inputImageRotation,
format: InputImageFormat.nv21,
bytesPerRow: image.planes.first.bytesPerRow,
),
);
}
)!;
}
InputImageRotation get inputImageRotation =>
InputImageRotation.values.byName(rotation.name);
InputImageFormat get inputImageFormat {
switch (format) {
case InputAnalysisImageFormat.bgra8888:
return InputImageFormat.bgra8888;
case InputAnalysisImageFormat.nv21:
return InputImageFormat.nv21;
default:
return InputImageFormat.yuv420;
}
}
}