aboutsummaryrefslogtreecommitdiff
path: root/en/devices/camera/motion-tracking.md
blob: 3c18d1d9ebaff254dab960c16116550c01d2976b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
Project: /_project.yaml
Book: /_book.yaml

{% include "_versions.html" %}

<!--
  Copyright 2018 The Android Open Source Project

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->

# Motion Tracking

In Android {{ androidPVersionNumber }}, camera devices can advertise
[motion tracking capability](https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MOTION_TRACKING){: .external}.
Cameras that support this feature do not produce motion tracking data itself,
but instead are used by ARCore or an image-stabilization algorithm along with
other sensors for scene analysis. To support this feature, devices must support
[`CONTROL_CAPTURE_INTENT_MOTION_TRACKING`](https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#CONTROL_CAPTURE_INTENT_MOTION_TRACKING){: .external}.
If this intent is part of the capture request, the camera must limit the
exposure time to a maximum of 20 milliseconds to reduce motion blur.

## Examples and source

A reference motion tracking implementation on the HAL side is available as part
of the
[Camera HAL](https://android.googlesource.com/platform/hardware/qcom/camera/+/master/msm8998/QCamera2/HAL3/QCamera3HWI.cpp){: .external}.

## Implementation

To enable motion tracking on a camera device, make sure:

+   The
    [`ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MOTION_TRACKING`](https://android.googlesource.com/platform/hardware/interfaces/+/master/camera/metadata/3.3/types.hal#231){: .external}
    capability is enabled.
+   The
    [`ANDROID_CONTROL_CAPTURE_INTENT_MOTION_TRACKING`](https://android.googlesource.com/platform/hardware/interfaces/+/master/camera/metadata/3.3/types.hal#207){: .external}
    intent is supported and when included in a capture request limits the camera
    exposure time to a maximum of 20 milliseconds.
+   Lens calibration data from the following list is accurately reported in the
    static information and dynamic metadata fields:

    +   [`ANDROID_LENS_POSE_ROTATION`](https://android.googlesource.com/platform/hardware/interfaces/+/master/camera/metadata/3.2/types.hal#747){: .external}  
    +   [`ANDROID_LENS_POSE_TRANSLATION`](https://android.googlesource.com/platform/hardware/interfaces/+/master/camera/metadata/3.2/types.hal#753){: .external}  
    +   [`ANDROID_LENS_INTRINSIC_CALIBRATION`](https://android.googlesource.com/platform/hardware/interfaces/+/master/camera/metadata/3.2/types.hal#773){: .external}  
    +   [`ANDROID_LENS_RADIAL_DISTORTION`](https://android.googlesource.com/platform/hardware/interfaces/+/master/camera/metadata/3.2/types.hal#780){: .external}  
    +   [`ANDROID_LENS_POSE_REFERENCE`](https://android.googlesource.com/platform/hardware/interfaces/+/master/camera/metadata/3.3/types.hal#79){: .external}  

## Validation

Camera devices supporting the motion tracking feature must pass the
[camera CTS tests](/compatibility/cts/camera-hal#cts_tests).