mrousavy / react-native-vision-camera

📸 A powerful, high-performance React Native Camera library.
https://react-native-vision-camera.com
MIT License
7.57k stars 1.1k forks source link

🐛 [Android] Preview quality is lower when setting frameProcessor #3292

Closed jongwan56 closed 3 days ago

jongwan56 commented 3 days ago

What's happening?

On Android, setting a frameProcessor significantly reduces the preview quality. This is not a frame drop issue; the preview simply looks lower in quality.

  1. Without frameProcessor Screenshot_20241113_163010_SURE

  2. With frameProcessor Screenshot_20241113_163030_SURE

Reproduceable Code

const device = useCameraDevice('back');

const frameProcessor = useFrameProcessor((frame) => {
  'worklet';
  console.log('frameProcessor');
}, []);

return (
  <Camera
    isActive={true}
    device={device}
    frameProcessor={frameProcessor}
  />
);

Relevant log output

11-13 21:04:02.798  8371  8371 D PreviewView: Surface requested by Preview.
11-13 21:04:02.806  8371  8371 D PreviewView: Preview transformation info updated. TransformationInfo{getCropRect=Rect(0, 0 - 1440, 1080), getRotationDegrees=90, getTargetRotation=0, hasCameraTransform=true, getSensorToBufferTransform=Matrix{[0.3529412, 0.0, -0.0][0.0, 0.3529412, -0.0][0.0, 0.0, 1.0]}, isMirroring=false}

Camera Device

{
  "formats": [],
  "sensorOrientation": "landscape-left",
  "hardwareLevel": "full",
  "maxZoom": 10,
  "minZoom": 0.6000000238418579,
  "maxExposure": 20,
  "supportsLowLightBoost": true,
  "neutralZoom": 1,
  "physicalDevices": [
    "wide-angle-camera",
    "ultra-wide-angle-camera",
    "wide-angle-camera",
    "telephoto-camera",
    "telephoto-camera"
  ],
  "supportsFocus": true,
  "supportsRawCapture": false,
  "isMultiCam": true,
  "minFocusDistance": 10,
  "minExposure": -20,
  "name": "0 (BACK) androidx.camera.camera2",
  "hasFlash": true,
  "hasTorch": true,
  "position": "back",
  "id": "0"
}

Device

Galaxy S24 Ultra (Android 14)

VisionCamera Version

4.6.1

Can you reproduce this issue in the VisionCamera Example app?

I didn't try (⚠️ your issue might get ignored & closed if you don't try this)

Additional information

maintenance-hans[bot] commented 3 days ago

Guten Tag, Hans here! It looks like you haven't tried to reproduce zis issue in ze VisionCamera Example app. For us to help you properly, please give it a shot and let us know if ze issue persists. Also, I suggest checking if everything is set up correctly, as we want to avoid missing out on any important details. If you need more help, feel free to consider supporting ze project by sponsoring it here, so we can prioritize issues better! 🍻

Note: If you think I made a mistake by closing this issue, please ping @mrousavy to take a look.

jongwan56 commented 3 days ago

@mrousavy The problem is easily reproducible with react-native 0.76.1 with newArchEnabled set to false, and react-native-vision-camera 4.6.1. Could you please take a look? Thank you for your assistance!