1

I'm working on an app that does face recognition. One of the steps include detecting the user when streaming the camera. For that, I am currently using google's Ml Kit. The application works fine on Android 10 OS but when I run on Android 13 OS it does not recognize any faces on any image.

Here's my face detected code

Future<void> detectFacesFromImage(CameraImage image) async {
    final WriteBuffer allBytes = WriteBuffer();
    for (final Plane plane in image.planes) {
      allBytes.putUint8List(plane.bytes);
    }
    final bytes = allBytes.done().buffer.asUint8List();
    final Size imageSize = Size(image.width.toDouble(), image.height.toDouble());
    InputImageRotation imageRotation = _cameraService.cameraRotation ??InputImageRotation.rotation0deg;
    final inputImageData = InputImageMetaData(
     size: imageSize,
     rotation: imageRotation,
     format: InputImageFormat.yuv420,
     bytesPerRow: image.planes[0].bytesRow,
    );
    InputImage _firebaseVisionImage = InputImage.fromBytes(
      bytes: bytes,
      metaData: inputImageData,
    );

    _faces = await _faceDetector.processImage(_firebaseVisionImage);
  }

If someone has any tips or can tell what I am doing wrong I would be very grateful.

0 Answers0