gpt4 book ai didi

android - 为 CameraX 设置目标分辨率不像文档中那样工作

转载 作者:行者123 更新时间:2023-12-04 01:41:21 27 4
gpt4 key购买 nike

我想使用 CameraX 库以固定分辨率(即 1200x1600 )拍摄照片。

因此,根据文档,我可以为 ImageCaptureConfig 设置目标分辨率:

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

文档描述 setTargetResolution方法如下:

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.



如果我错了,请纠正我,但如果设备能够拍摄大于 1200x1600 的照片(例如 3024x4032 ),输出照片将至少为 1200x1600 .

不幸的是,在许多设备中(例如 Huawei P20 ProSamsung A5),输出照片明显小于 1200x1600。 ,例如 480x640 .请注意,这些设备能够拍摄非常大的照片。

是我的 ImageCaptureConfig配置不当或者这是一个错误?

最佳答案

android documentation说这个:

You cannot set both target aspect ratio and target resolution on the same use case. Doing so will throw an IllegalArgumentException when building the config object.


所以决定什么对你来说更重要,然后只选择一个。

关于android - 为 CameraX 设置目标分辨率不像文档中那样工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57254960/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com