Setting target resolution for CameraX not working as in documentation

旧街凉风 提交于 2019-12-20 03:29:18

问题


I want to capture photos with fixed resolution (i.e. 1200x1600) using CameraX library.

So according to documentation I can set target resolution for ImageCaptureConfig:

val imageCaptureConfig = ImageCaptureConfig.Builder()
    .setLensFacing(CameraX.LensFacing.BACK)
    .setCaptureMode(ImageCapture.CaptureMode.MAX_QUALITY)
    .setTargetResolution(Size(1200, 1600))
    .setTargetAspectRatio(Rational(3,4))
    .build()

Documentation describes setTargetResolution method as follows:

Sets the intended output target resolution.

The target resolution attempts to establish a minimum bound for the image resolution. The actual image resolution will be the closest available resolution in size that is not smaller than the target resolution, as determined by the Camera implementation. However, if no resolution exists that is equal to or larger than the target resolution, the nearest available resolution smaller than the target resolution will be chosen.

Correct me if I am wrong, but if device is able to take photos larger than 1200x1600 (e.g. 3024x4032), the output photo will be at least 1200x1600.

Unfortunately in many devices (e.g. Huawei P20 Pro, Samsung A5) the output photo is significantly smaller than 1200x1600, e.g. 480x640. Notice that these devices are able to take really large photos.

Is my ImageCaptureConfig badly configured or this is a bug?


回答1:


It could be a bug that have been recently fixed at AOSP. refer https://android.googlesource.com/platform/frameworks/support/+/5c1aed8c4c502a74eb4ee6d30fe2089f4afcaf11



来源:https://stackoverflow.com/questions/57254960/setting-target-resolution-for-camerax-not-working-as-in-documentation

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