cameraController.initialize().then(
(value) {
setState(
() {
cameraController.startImageStream(
(изображение) {
попробуйте {
debugPrint('camera_no formate${image.format.raw}');
debugPrint('camera_no size${image.planes.length}') ;
Код: Выделить всё
final WriteBuffer allBytes = WriteBuffer();
for (Plane plane in image.planes) {
allBytes.putUint8List(plane.bytes);
}
final bytes = allBytes.done().buffer.asUint8List();
final imageSize =
Size(image.width.toDouble(), image.height.toDouble());
final imageRotation = InputImageRotationValue.fromRawValue(
cameraDescription.sensorOrientation) ??
InputImageRotation.rotation0deg;
final imageFormat =
InputImageFormatValue.fromRawValue(image.format.raw) ??
InputImageFormat.nv21;
final metaData = InputImageMetadata(
size: imageSize,
rotation: imageRotation,
format: imageFormat,
bytesPerRow: image.planes[0].bytesPerRow,
);
final faceDetector = FaceDetector(options: option);
final inputImage = InputImage.fromBytes(
bytes: bytes,
metadata: metaData,
);
faceDetector.processImage(inputImage).then((value) {
if (value.isEmpty) {
debugPrint('camera_no face detected${value.length}');
}
if (value.isNotEmpty) {
debugPrint('camera_no face detected${value.length}');
}
});
} catch (e) {
debugPrint('camera_no ERORR$e');
}
},
);
},
);
},
);
} catch (e) {
debugPrint('camera_initilize_error:- $e');
}`
Я пытаюсь использовать канал метода для обнаружения лиц, но он не работает должным образом.
Я ожидаю использовать пакет камеры и пакет google_mlkit_face_detection для обнаружения лица на камере в реальном времени
Подробнее здесь: https://stackoverflow.com/questions/787 ... on-package