From d3dbfb3f75cb1a6351e79d137c7ccfce498672cf Mon Sep 17 00:00:00 2001 From: Eino-Ville Talvala Date: Fri, 29 May 2015 17:17:04 -0700 Subject: Camera: Change origin of poseTranslation. No actual defined center for the Android sensor coordinate system exists, so define the translation relative to the largest camera device facing the same way. Bug: 20123879 Change-Id: Ica33d23717c976c063c26b768af5b6148483909c --- .../hardware/camera2/CameraCharacteristics.java | 33 ++++++++++++++++++---- .../android/hardware/camera2/CaptureResult.java | 33 ++++++++++++++++++---- 2 files changed, 54 insertions(+), 12 deletions(-) diff --git a/core/java/android/hardware/camera2/CameraCharacteristics.java b/core/java/android/hardware/camera2/CameraCharacteristics.java index d5867a9654f1..803e3842b511 100644 --- a/core/java/android/hardware/camera2/CameraCharacteristics.java +++ b/core/java/android/hardware/camera2/CameraCharacteristics.java @@ -1003,12 +1003,33 @@ public final class CameraCharacteristics extends CameraMetadataPosition of the camera optical center.

- *

As measured in the device sensor coordinate system, the - * position of the camera device's optical center, as a - * three-dimensional vector (x,y,z).

- *

To transform a world position to a camera-device centered - * coordinate system, the position must be translated by this - * vector and then rotated by {@link CameraCharacteristics#LENS_POSE_ROTATION android.lens.poseRotation}.

+ *

The position of the camera device's lens optical center, + * as a three-dimensional vector (x,y,z), relative to the + * optical center of the largest camera device facing in the + * same direction as this camera, in the {@link android.hardware.SensorEvent Android sensor coordinate + * axes}. Note that only the axis definitions are shared with + * the sensor coordinate system, but not the origin.

+ *

If this device is the largest or only camera device with a + * given facing, then this position will be (0, 0, 0); a + * camera device with a lens optical center located 3 cm from + * the main sensor along the +X axis (to the right from the + * user's perspective) will report (0.03, 0, 0).

+ *

To transform a pixel coordinates between two cameras + * facing the same direction, first the source camera + * android.lens.radialDistortion must be corrected for. Then + * the source camera android.lens.intrinsicCalibration needs + * to be applied, followed by the {@link CameraCharacteristics#LENS_POSE_ROTATION android.lens.poseRotation} + * of the source camera, the translation of the source camera + * relative to the destination camera, the + * {@link CameraCharacteristics#LENS_POSE_ROTATION android.lens.poseRotation} of the destination camera, and + * finally the inverse of android.lens.intrinsicCalibration + * of the destination camera. This obtains a + * radial-distortion-free coordinate in the destination + * camera pixel coordinates.

+ *

To compare this against a real image from the destination + * camera, the destination camera image then needs to be + * corrected for radial distortion before comparison or + * sampling.

*

Units: Meters

*

Optional - This value may be {@code null} on some devices.

* diff --git a/core/java/android/hardware/camera2/CaptureResult.java b/core/java/android/hardware/camera2/CaptureResult.java index df6c986da819..3bb2fdb31e39 100644 --- a/core/java/android/hardware/camera2/CaptureResult.java +++ b/core/java/android/hardware/camera2/CaptureResult.java @@ -2584,12 +2584,33 @@ public class CaptureResult extends CameraMetadata> { /** *

Position of the camera optical center.

- *

As measured in the device sensor coordinate system, the - * position of the camera device's optical center, as a - * three-dimensional vector (x,y,z).

- *

To transform a world position to a camera-device centered - * coordinate system, the position must be translated by this - * vector and then rotated by {@link CameraCharacteristics#LENS_POSE_ROTATION android.lens.poseRotation}.

+ *

The position of the camera device's lens optical center, + * as a three-dimensional vector (x,y,z), relative to the + * optical center of the largest camera device facing in the + * same direction as this camera, in the {@link android.hardware.SensorEvent Android sensor coordinate + * axes}. Note that only the axis definitions are shared with + * the sensor coordinate system, but not the origin.

+ *

If this device is the largest or only camera device with a + * given facing, then this position will be (0, 0, 0); a + * camera device with a lens optical center located 3 cm from + * the main sensor along the +X axis (to the right from the + * user's perspective) will report (0.03, 0, 0).

+ *

To transform a pixel coordinates between two cameras + * facing the same direction, first the source camera + * android.lens.radialDistortion must be corrected for. Then + * the source camera android.lens.intrinsicCalibration needs + * to be applied, followed by the {@link CameraCharacteristics#LENS_POSE_ROTATION android.lens.poseRotation} + * of the source camera, the translation of the source camera + * relative to the destination camera, the + * {@link CameraCharacteristics#LENS_POSE_ROTATION android.lens.poseRotation} of the destination camera, and + * finally the inverse of android.lens.intrinsicCalibration + * of the destination camera. This obtains a + * radial-distortion-free coordinate in the destination + * camera pixel coordinates.

+ *

To compare this against a real image from the destination + * camera, the destination camera image then needs to be + * corrected for radial distortion before comparison or + * sampling.

*

Units: Meters

*

Optional - This value may be {@code null} on some devices.

* -- cgit v1.2.3-59-g8ed1b