Status Update
Comments
va...@gmail.com <va...@gmail.com> #2
After some googling I found https://github.com/android/camera-samples/blob/master/CameraXBasic/app/src/main/java/com/android/example/cameraxbasic/utils/AutoFitPreviewBuilder.kt which does what I want. Would it be possible to fold this into the main library or at least make it configurable without the need for that class?
er...@google.com <er...@google.com> #3
Hi Charcoal,
Are we getting a crop mode here? Thanks!
Are we getting a crop mode here? Thanks!
to...@google.com <to...@google.com> #4
Hello,
Thanks for raising this up. May we know did you set aspect ratio or resolution for Preview use case? And could you also attach the captured image file?
Thanks for raising this up. May we know did you set aspect ratio or resolution for Preview use case? And could you also attach the captured image file?
va...@gmail.com <va...@gmail.com> #5
The captured image file is part of the image file that I've already attached (the right part).
I did not set anything on the Preview use case other than the lens facing.
```
val cameraPreview = Preview(Builder()
.setLensFacing(CameraX.LensFacing.BACK)
.build())
cameraPreview.setOnPreviewOutputUpdateListener {
// Every time the viewfinder is updated, recompute the layout. By removing and re-adding it.
val parent = parent as ViewGroup
parent.removeView(this)
parent.addView(this, 0)
surfaceTexture = it.surfaceTexture
updateTransform()
}
CameraX.bindToLifecycle(lifecycleOwner, cameraPreview, *useCase)
```
I did not set anything on the Preview use case other than the lens facing.
```
val cameraPreview = Preview(Builder()
.setLensFacing(CameraX.LensFacing.BACK)
.build())
cameraPreview.setOnPreviewOutputUpdateListener {
// Every time the viewfinder is updated, recompute the layout. By removing and re-adding it.
val parent = parent as ViewGroup
parent.removeView(this)
parent.addView(this, 0)
surfaceTexture = it.surfaceTexture
updateTransform()
}
CameraX.bindToLifecycle(lifecycleOwner, cameraPreview, *useCase)
```
to...@google.com <to...@google.com> #6
Would you also set the same TargetRotation to Preview at onOrientationChanged? Let me know if it works.
er...@google.com <er...@google.com> #7
Hi There,
It's been just over a month and we are clearing out issues without response. If you have any feedback please feel free to reopen or file another issue. Thanks!
ch...@google.com <ch...@google.com> #8
This should be caused by same root cause of https://b.corp.google.com/issues/148763432 .
There is default aspect ratio custom set to ImageCapture use case but it is not updated to match the new target rotation value.
There is default aspect ratio custom set to ImageCapture use case but it is not updated to match the new target rotation value.
Description
CAMERA APPLICATION NAME AND VERSION: 7.2.016.279154257
ANDROID OS BUILD NUMBER: QP1A.191105.003
DEVICE NAME: Pixel 3XL
DESCRIPTION:
Using CameraX and the following snippet to take photos in portrait / landscape depending on the orientation:
```
val listener = object : OrientationEventListener(activity, SensorManager.SENSOR_DELAY_NORMAL) {
override fun onOrientationChanged(orientation: Int) {
imageCapture.setTargetRotation(when (orientation) {
in 46..115 -> Surface.ROTATION_270
in 236..325 -> Surface.ROTATION_90
in 116..235 -> Surface.ROTATION_180
else -> Surface.ROTATION_0
})
}
}
listener.enable()
```
One thing I've noticed is that landscape pictures are cut off. The TextureView is showing a lot more of the image than the final image being saved when using ImageCapture. (Attached image for comparison).
Currently, my ImageCapture is quite empty (the target rotation is set via the listener):
```
val imageCapture = ImageCapture(ImageCaptureConfig.Builder()
.build())
```
Is there any special method I need to call to get the full landscape picture? I can reproduce this all the time.