Search code examples
flutterimage-processingreal-time

Is it possible to process images in the camera view with flutter and official plugins?


I'd like to process some images with firebase and based on the results print something over the image but instead of using an image from imagepicker I wanto do it while the camera is running live.

Is this possible using default plugins? I've been searching for hours but I've not able to find anything to interact frame per frame.


Solution

  • You can use the official Camera plugin

    https://pub.dev/packages/camera

    Camera controller has a startImageStream method where you can listen to image stream and process frame by frame like this:

      controller = CameraController(cameras[0], ResolutionPreset.medium);
      controller.initialize().then((_) {
        if (!mounted) {
          return;
        }
    
        controller.startImageStream((CameraImage availableImage) {
           // process the frame here
        });
      });