Skip to content

[camera_android_camerax] Support RGBA_8888 image format group  #151193

Description

@TecHaxter

Use case

The plugin only supports YUV_420 image format group, because Flutter does not support RGBA format currently.
But the camerax library allows RGBA_8888 format group as well.
Supporting RGBA_8888 format would allow flutter developers to do computer vision tasks like face detection, image classification, image segmentation, etc.

Proposal

Expecting the plugin to be able to do something like this:

CameraController cameraController = CameraController(
    cameras![selectedCameraIndex],
    ResolutionPreset.medium,
    imageFormatGroup: ImageFormatGroup.rgba8888,
);
cameraController.startImageStream((CameraImage image) {
    ///Computer vision tasks with rgba8888 image format group bytes
});

Reference

Found this while reading the documented source code of intializeCamera in packages\camera\camera_android_camerax\lib\src\android_camera_camerax.dart

  /// Initializes the camera on the device.
  ///
  /// Since initialization of a camera does not directly map as an operation to
  /// the CameraX library, this method just retrieves information about the
  /// camera and sends a [CameraInitializedEvent].
  ///
  /// [imageFormatGroup] is used to specify the image format used for image
  /// streaming, but CameraX currently only supports YUV_420_888 (supported by
  /// Flutter) and RGBA (not supported by Flutter). CameraX uses YUV_420_888
  /// by default, so [imageFormatGroup] is not used.
  @override
  Future<void> initializeCamera(
    int cameraId, {
    ImageFormatGroup imageFormatGroup = ImageFormatGroup.unknown,
  }) async {
  ...
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterp: cameraThe camera pluginpackageflutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyteam-androidOwned by Android platform teamtriaged-androidTriaged by Android platform team

    Type

    No type

    Projects

    Status
    [Non-blocking] Proposals

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions