Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 Orientation have different values on front and back camera #3049

Open
5 tasks done
luicfrr opened this issue Jul 4, 2024 · 2 comments
Open
5 tasks done

馃悰 Orientation have different values on front and back camera #3049

luicfrr opened this issue Jul 4, 2024 · 2 comments
Labels
馃悰 bug Something isn't working

Comments

@luicfrr
Copy link
Contributor

luicfrr commented Jul 4, 2024

What's happening?

I am not sure if it's supposed to work this way or if it's actually a bug, but I noticed an orientation inconsistency between Android and iOS when switching cameras.

Both devices were tested in portrait mode, with screen orientation locked, and only switching between the front and back cameras.

On iOS, for both cameras, frame.orientation returned UIImage.Orientation.right. The device didn't change its orientation, so the frame orientation stayed the same.

However, on Android, the front camera returns Orientation.LANDSCAPE_LEFT and the back camera returns Orientation.LANDSCAPE_RIGHT.

I believe one of the systems is returning the wrong orientation value for one of the cameras.

Reproduceable Code

const [
  facingFront,
  setFacingFront
] = useState<boolean>( true )
const cameraDevice = useCameraDevice( facingFront ? 'front' : 'back' )

...

<Camera
  style={ StyleSheet.absoluteFill }
  isActive={ true }
  device={ cameraDevice }
  outputOrientation={ 'device' }
/>
<Button
  onPress={ () => setFacingFront( ( current ) => !current ) }
  title={ 'Toggle Cam' }
/>

Relevant log output

IOS
both front and back camera: frame.isMirrored: false - frame.orientation: UIImageOrientation(rawValue: 2)

ANDROID:
front camera: frame.isMirrored: false - frame.orientation: LANDSCAPE_LEFT
back camera: frame.isMirrored: false - frame.orientation: LANDSCAPE_RIGHT

Camera Device

IOS: {
  "minFocusDistance": 12,
  "hardwareLevel": "full",
  "isMultiCam": false,
  "id": "com.apple.avfoundation.avcapturedevice.built-in_video:0",
  "maxZoom": 16,
  "hasTorch": true,
  "supportsFocus": true,
  "supportsRawCapture": false,
  "neutralZoom": 1,
  "physicalDevices": [
    "wide-angle-camera"
  ],
  "position": "back",
  "supportsLowLightBoost": false,
  "maxExposure": 8,
  "sensorOrientation": "portrait",
  "minExposure": -8,
  "name": "Back Camera",
  "hasFlash": true,
  "formats": [],
  "minZoom": 1
}

Android: {
  "hardwareLevel": "limited",
  "minExposure": -20,
  "neutralZoom": 1,
  "minZoom": 1,
  "supportsFocus": false,
  "formats": [],
  "supportsLowLightBoost": false,
  "hasTorch": false,
  "supportsRawCapture": false,
  "minFocusDistance": 0,
  "sensorOrientation": "landscape-right",
  "maxZoom": 4,
  "physicalDevices": [
    "wide-angle-camera"
  ],
  "isMultiCam": false,
  "position": "front",
  "id": "1",
  "hasFlash": false,
  "maxExposure": 20,
  "name": "1 (FRONT) androidx.camera.camera2"
}

Device

Iphone 11 (IOS 17.5.1) - Galaxy J5 (Android 8.0)

VisionCamera Version

4.4.1

Can you reproduce this issue in the VisionCamera Example app?

Yes, I can reproduce the same issue in the Example app here

Additional information

@luicfrr luicfrr added the 馃悰 bug Something isn't working label Jul 4, 2024
@maintenance-hans maintenance-hans bot changed the title 馃悰 Orientation have different values on front and back camera 馃悰 Orientation have different values on front and back camera Jul 4, 2024
Copy link

Guten Tag, Hans here.

Note

New features, bugfixes, updates and other improvements are all handled mostly by @mrousavy in his free time.
To support @mrousavy, please consider 馃挅 sponsoring him on GitHub 馃挅.
Sponsored issues will be prioritized.

@Marius-Adam
Copy link

Marius-Adam commented Jul 5, 2024

+1 here.
I am using a frame processor and it impacts the text recognition (works as expected when phone in landscape but does not pick anything up when device held in portrait)

Also opened an issue here: #3051

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
馃悰 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants