
As a result, theīuffer is rotated 90 degrees clockwise.

Orientation matches the device orientation:Ī back-facing camera would produce an image buffer with the same orientationĪs the buffer above, but SENSOR_ORIENTATION is 90 degrees. The image must be rotated 270 degrees counterclockwise so that the preview’s Produced by the camera sensor looks like this: The rotation is counterclockwise for back-facing cameras, clockwise.įor example, for the front-facing camera in figure 1, the image buffer Number of degrees specified by SENSOR_ORIENTATION for the camera preview toĪppear upright in the device’s natural orientation. Sensor’s natural orientation (landscape), the image buffer must be rotated the

Or sensor-portrait for phones and tablets, landscape for laptops, landscapeīecause camera image sensors output their data (an image buffer) in the Note: Natural (or native) orientation is the typical orientation of a device Of 270 degrees for front-facing cameras and 90 degrees (point of view from theīack of the device) for back-facing cameras, which aligns the long edge of the For most phones and tablets, the device reports a sensor orientation To expose the sensor rotation to apps, theĬonstant. Of the front-facing camera (the camera pointing in the same direction as theĭisplay) is rotated 270 degrees relative to the phone to comply with the The camera sensor’s natural orientation is landscape. Typical relationship of phone and camera sensor Also, image sensors typically output their data in landscape aspect This arrangement maximizes the display area for the camera viewfinder in aĬamera app. Specifies that a camera image sensor “MUST be oriented so that the longĭimension of the camera aligns with the screen’s long dimension.” The same orientation as the primary display. Multi-display mode enables the use of secondary displays which might not be in

Screen, scaling the camera preview regardless of device orientation.

Multi-window mode constrains camera apps to a portion of the Foldable devices change display size and aspect ratio without changing When the phone (and camera) are rotated to landscape, theĬamera preview is expected to be wider than it is tall.īut these assumptions are challenged by new form factors, such as Phone is in portrait orientation, the camera preview is assumed to be taller Orientation of the device and the aspect ratio of the camera preview. When the device orientation changes, theĪs a result, camera apps generally assume a fixed relationship between the Both CameraX and Camera2 support Android 5.0 (API level 21) and higher.Ĭameras and camera previews aren’t always in the same orientation on AndroidĪ camera is in a fixed position on a device, regardless of whether the device Unless your app requires specific, low-level features from Camera2, we recommend using CameraX. Note: This page refers to the Camera2 package.
