问题
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