为什么camera2支持的预览尺寸宽度总是大于高度? [英] Why camera2 supported preview size width always bigger than height?
问题描述
我正在研究一个使用camera2 API的项目。当我使用以下命令获得支持的输出预览大小的列表时:
I'm working on a project which using camera2 API. When I get the list of supported output preview size using:
StreamConfigurationMap map = characteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
Size[] choices = map.getOutputSizes(SurfaceTexture.class);
输出大小列表始终返回宽度为height的值,尽管屏幕宽度
当我使用 getResources()。getDisplayMetrics()
(或任何类似方法)检查宽度/高度时,总是返回width
并且基于该值,我发现在2种情况下width / height可能会交换其值。 (w:1920,h:1080预览尺寸。w:1080,h:1920屏幕尺寸)。
the output size list always return values which have width>height despite the fact that screen's width
When I use getResources().getDisplayMetrics()
(or any similar method) to check width/height it's always return width
And based on the value I see that in 2 cases the width/height are likely swap their value. (w: 1920, h: 1080 preview size. w: 1080, h: 1920 screen size).
那么它们之间有什么区别?
So what is the different between them? Please help me!
推荐答案
手机上的摄像头通常是为设备的横向模式而设计的。我们使用90度旋转
The camera on phones is traditionally built for landscape orientation of the device. We use rotation of 90° to display camera frames correctly when the device is held in portrait orientation.
这里是详细说明:
https://developer.android.com/training/camera/cameradirect.html#TaskOrientation
这篇关于为什么camera2支持的预览尺寸宽度总是大于高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!