Fixed
Status Update
Comments
ch...@google.com <ch...@google.com> #2
Hi Ed, Thank you so much for these suggestions. I've been reviewing them and merging them in. Hopefully it should be live. I've included a thank you note too in the article.
ch...@google.com <ch...@google.com>
ap...@google.com <ap...@google.com> #3
Great! Thanks a lot, I'll look for the live updates soon!
ap...@google.com <ap...@google.com> #4
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 7713a197bd9f99c1120b340ff5b797e2a3fa0f2c
Author: charcoalchen <charcoalchen@google.com>
Date: Wed Feb 19 18:38:31 2020
Change setTargetAspectRatioCustom API name to setCropAspectRatio
ImageCapture#setTargetAspectRatioCustom is public API and used for
cropping output image. New API name makes it easier to understand for
the developers.
Bug: b/148763432
Test: manual test and ./gradlew bOS
Change-Id: I15a606c6b4e5ebbb57d5aa67ac10617d4df3165a
M camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/ImageCaptureTest.java
M camera/camera-core/api/1.0.0-beta01.txt
M camera/camera-core/api/current.txt
M camera/camera-core/api/public_plus_experimental_1.0.0-beta01.txt
M camera/camera-core/api/public_plus_experimental_current.txt
M camera/camera-core/api/restricted_1.0.0-beta01.txt
M camera/camera-core/api/restricted_current.txt
M camera/camera-core/src/main/java/androidx/camera/core/ImageCapture.java
M camera/camera-view/src/main/java/androidx/camera/view/CameraXModule.java
https://android-review.googlesource.com/1239310
Branch: androidx-master-dev
commit 7713a197bd9f99c1120b340ff5b797e2a3fa0f2c
Author: charcoalchen <charcoalchen@google.com>
Date: Wed Feb 19 18:38:31 2020
Change setTargetAspectRatioCustom API name to setCropAspectRatio
ImageCapture#setTargetAspectRatioCustom is public API and used for
cropping output image. New API name makes it easier to understand for
the developers.
Bug:
Test: manual test and ./gradlew bOS
Change-Id: I15a606c6b4e5ebbb57d5aa67ac10617d4df3165a
M camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/ImageCaptureTest.java
M camera/camera-core/api/1.0.0-beta01.txt
M camera/camera-core/api/current.txt
M camera/camera-core/api/public_plus_experimental_1.0.0-beta01.txt
M camera/camera-core/api/public_plus_experimental_current.txt
M camera/camera-core/api/restricted_1.0.0-beta01.txt
M camera/camera-core/api/restricted_current.txt
M camera/camera-core/src/main/java/androidx/camera/core/ImageCapture.java
M camera/camera-view/src/main/java/androidx/camera/view/CameraXModule.java
ch...@google.com <ch...@google.com> #5
The issue will happen in the following three general use cases.
Case 1. Create ImageCapture with target resolution → update target rotation → get wrong output image
Case 2. Create ImageCapture without target resolution → update target rotation → get wrong output image
Case 3. Create ImageCapture with AspectRatio.RATIO_16_9 → update target rotation → get wrong 4:3 output image
Root cause for each case:
For 1, setTargetResolution will also call setTargetAspectRatioCustom but it isn’t updated to match the new target rotation.
For 2, there is a default 4:3 custom aspect ratio setting but it isn’t updated to match the new target rotation.
For 3, there is a default 4:3 custom aspect ratio setting to crop output image even developers have set target aspect ratio as 16:9.
Solution:
Automatically updating corresponding target resolution and aspect ratio custom values when target rotation value is updated. Don’t set the default custom aspect ratio setting when there is target aspect ratio set by the developers.
Case 1. Create ImageCapture with target resolution → update target rotation → get wrong output image
Case 2. Create ImageCapture without target resolution → update target rotation → get wrong output image
Case 3. Create ImageCapture with AspectRatio.RATIO_16_9 → update target rotation → get wrong 4:3 output image
Root cause for each case:
For 1, setTargetResolution will also call setTargetAspectRatioCustom but it isn’t updated to match the new target rotation.
For 2, there is a default 4:3 custom aspect ratio setting but it isn’t updated to match the new target rotation.
For 3, there is a default 4:3 custom aspect ratio setting to crop output image even developers have set target aspect ratio as 16:9.
Solution:
Automatically updating corresponding target resolution and aspect ratio custom values when target rotation value is updated. Don’t set the default custom aspect ratio setting when there is target aspect ratio set by the developers.
Description
Please describe your issue and include details such as the version of CameraX you are using and any relevant logs related to your issue.
# If at all possible, capture an Android logcat (
# the camera is still active.
CAMERAX VERSION (ex - 1.0.0-alpha07)
1.0.0-alpha09
CAMERA APPLICATION NAME AND VERSION: (Settings > Apps > (app name) > version)
N/A
ANDROID OS BUILD NUMBER: (Settings > About > Build number)
N/A
DEVICE NAME: (Nexus 5X, Samsung S6, etc)
N/A
DESCRIPTION:
Aspect ratio of saved image doesn't match setTargetResolution when locking display orientation and setting target rotation with OrientationEventListener. What is the correct way to set target resolution when display orientation is locked?
STEPS TO REPRODUCE:
1. Lock application in portrait mode.
2. Create ImageCapture use case with setTargetResolution(Size(1080, 1920)).
3. Use OrientationEventListener to set the target rotation.
4. Take a picture in landscape orientation.
OBSERVED RESULTS:
The saved image is 608x1080.
EXPECTED RESULTS:
The saved image should be 1920x1080.
REPRODUCIBILITY: (5 of out 5, 1 out of 100, etc)
5 of out 5
ADDITIONAL INFORMATION:
N/A
CODE FRAGMENTS (this will help us troubleshoot your issues):
<activity
android:name=".camera.camerax.CameraActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:screenOrientation="portrait" />
private fun createCaptureUseCase(): ImageCapture {
return ImageCapture.Builder()
.setTargetName("Capture")
.setTargetResolution(Size(1080, 1920))
.setCaptureMode(ImageCapture.CAPTURE_MODE_MINIMIZE_LATENCY)
.build()
}