CameraX chooses low resolution for given aspect ratio

半腔热情 提交于 2019-12-24 07:34:34

问题


I want to get the best quality for square aspect ratio and setup the next preview and capture configs for CameraX.

val SQUARE_ASPECT_RATIO = Rational(1, 1)

val previewConfig = PreviewConfig.Builder().apply {
    setTargetAspectRatio(SQUARE_ASPECT_RATIO)
    setTargetRotation(viewFinder.display.rotation)
}.build()
preview = Preview(previewConfig)

val imageCaptureConfig = ImageCaptureConfig.Builder().apply {
    setCaptureMode(ImageCapture.CaptureMode.MAX_QUALITY)
    setTargetAspectRatio(SQUARE_ASPECT_RATIO)
    setTargetRotation(viewFinder.display.rotation)
}.build()
imageCapture = ImageCapture(imageCaptureConfig)

CameraX.bindToLifecycle(this, preview, imageCapture)

CameraX chooses 352x288px resolution, so result image resolution equals 288x288px. From documentation it should be the highest resolution available for current device, but it is not.

Tested on emulator and Google Pixel 3.

来源:https://stackoverflow.com/questions/57952151/camerax-chooses-low-resolution-for-given-aspect-ratio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!