Why camera2 supported preview size width always bigger than height?

这一生的挚爱 提交于 2019-12-04 05:25:14

问题


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);

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!


回答1:


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.

Here is the detailed explanation: https://developer.android.com/training/camera/cameradirect.html#TaskOrientation



来源:https://stackoverflow.com/questions/49684999/why-camera2-supported-preview-size-width-always-bigger-than-height

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