Content-Length: 357845 | pFad | https://github.com/flutter/flutter/issues/145961

30 [camera_android_camerax] Cannot set imageFormatGroup to ImageFormatGroup.nv21 · Issue #145961 · flutter/flutter · GitHub
Skip to content

[camera_android_camerax] Cannot set imageFormatGroup to ImageFormatGroup.nv21 #145961

@CaoGiaHieu-dev

Description

@CaoGiaHieu-dev

Steps to reproduce

init camera android by using code below

 _controller = CameraController(
      camera,
      ResolutionPreset.high,
      enableAudio: false,
      imageFormatGroup: Platform.isAndroid
          ? ImageFormatGroup.nv21
          : ImageFormatGroup.bgra8888,
    );
   _controller?.startImageStream(_processCameraImage);
   

Expected results

_processCameraImage(InputImage image){
if (_controller == null) return null;
    InputImageRotation? rotation;
    if (Platform.isIOS) {
      rotation = InputImageRotationValue.fromRawValue(sensorOrientation);
    } else if (Platform.isAndroid) {
      var rotationCompensation =
          _orientations[_controller!.value.deviceOrientation];
      if (rotationCompensation == null) return null;
      if (camera.lensDirection == CameraLensDirection.front) {
        rotationCompensation = (sensorOrientation + rotationCompensation) % 360;
      } else {
        rotationCompensation =
            (sensorOrientation - rotationCompensation + 360) % 360;
      }
      rotation = InputImageRotationValue.fromRawValue(rotationCompensation);
    }
    if (rotation == null) return null;
    final format = InputImageFormatValue.fromRawValue(image.format.raw);
    print(format); => return format should return as ImageFormatGroup.nv21InputImageFormat.nv21
}

Actual results

format return InputImageFormat.yuv_420_888

Code sample

Code sample Using code [example of google ml kit](https://github.com/flutter-ml/google_ml_kit_flutter/tree/develop/packages/example) and add camera_android_camerax

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[Paste your output here]

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listfound in release: 3.19Found to occur in 3.19found in release: 3.22Found to occur in 3.22has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: 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

To do

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions









    ApplySandwichStrip

    pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


    --- a PPN by Garber Painting Akron. With Image Size Reduction included!

    Fetched URL: https://github.com/flutter/flutter/issues/145961

    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy