googlesamples / googlesamples/mlkit

CameraXSource getPreviewSize() does not return the correct size in portrait

Open
#600 0 comments 0 reactions 1 assignee Claimed by @zhouyiself View on GitHub
Dominant language
Kotlin
Stars
4.3k
Forks
3.1k
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
CameraXSourceDemoActivity prints width and height of 1088 x 1088.

**To Reproduce**
Example Steps to reproduce the behavior in sample app:
1. Run CameraXSourceDemoActivity on android device in portrait mode.
2. In portrait mode we get a width of 1088 and height of 1088 printed out.

https://github.com/googlesamples/mlkit/blob/4be2fe856e0b3fd95af370fe5413a33494698067/android/vision-quickstart/app/src/main/java/com/google/mlkit/vision/demo/java/CameraXSourceDemoActivity.java#L174

**Expected behavior**
Should return a value closer to 480 x 640.
Works as expected if we run it in landscape mode, we get 640 x 480 printed out.

**SDK Info:**
- com.google.mlkit:camera:16.0.0-beta3
- com.google.mlkit:pose-detection:18.0.0-beta3
- androidx.camera:camera-camera2:1.1.0
- androidx.camera:camera-lifecycle:1.1.0
- androidx.camera:camera-view:1.1.0

**Smartphone:**
- Galaxy A04s

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.