blob: 2fdd4664beba4cc159074a488daff3d52fde2ec5 [file] [log] [blame]
Eino-Ville Talvalab2675542012-12-12 13:29:45 -08001/*
2 * Copyright (C) 2012 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.hardware.photography;
18
19import android.graphics.Point;
20import android.graphics.Rect;
21
22/**
23 * <p>The results of a single image capture from the image sensor.</p>
24 *
25 * <p>Contains the final configuration for the capture hardware (sensor, lens,
26 * flash), the processing pipeline, the control algorithms, and the output
27 * buffers.</p>
28 *
29 * <p>CaptureResults are produced by a {@link CameraDevice} after processing a
30 * {@link CaptureRequest}. All properties listed for capture requests can also
31 * be queried on the capture result, to determine the final values used for
32 * capture. The result also includes additional metadata about the state of the
33 * camera device during the capture.</p>
34 *
35 */
36public final class CaptureResult extends CameraMetadata {
37
38 /**
39 * The timestamp representing the start of image capture, in nanoseconds.
40 * This corresponds to the timestamp available through
41 * {@link android.graphics.SurfaceTexture#getTimestamp SurfaceTexture.getTimestamp()}
42 * or {@link android.media.Image#getTimestamp Image.getTimestamp()} for this
43 * capture's image data.
44 */
Igor Murashkinb519cc52013-07-02 11:23:44 -070045 public static final Key<Long> SENSOR_TIMESTAMP =
46 new Key<Long>("android.sensor.timestamp", Long.TYPE);
Eino-Ville Talvalab2675542012-12-12 13:29:45 -080047
48 /**
49 * The state of the camera device's auto-exposure algorithm. One of the
50 * CONTROL_AE_STATE_* enumerations.
51 */
Igor Murashkinb519cc52013-07-02 11:23:44 -070052 public static final Key<Integer> CONTROL_AE_STATE =
53 new Key<Integer>("android.control.aeState", Integer.TYPE);
Eino-Ville Talvalab2675542012-12-12 13:29:45 -080054
55 /**
56 * The auto-exposure algorithm is inactive.
57 * @see CONTROL_AE_STATE
58 */
59 public static final int CONTROL_AE_STATE_INACTIVE = 0;
60
61 /**
62 * The auto-exposure algorithm is currently searching for proper exposure.
63 * @see CONTROL_AE_STATE
64 */
65 public static final int CONTROL_AE_STATE_SEARCHING = 1;
66
67 /**
68 * The auto-exposure algorithm has reached proper exposure values for the
69 * current scene.
70 * @see CONTROL_AE_STATE
71 */
72 public static final int CONTROL_AE_STATE_CONVERGED = 2;
73
74 /**
75 * The auto-exposure algorithm has been locked to its current values.
76 * @see CONTROL_AE_STATE
77 */
78 public static final int CONTROL_AE_STATE_LOCKED = 3;
79
80 /**
81 * The auto-exposure algorithm has reached proper exposure values as with
82 * CONTROL_AE_STATE_CONVERGED, but the scene is too dark to take a good
83 * quality image without firing the camera flash.
84 * @see CONTROL_AE_STATE
85 */
86 public static final int CONTROL_AE_STATE_FLASH_REQUIRED = 4;
87
88 /**
89 * The precapture sequence of the auto-exposure algorithm has been triggered,
90 * and is underway.
91 * @see CONTROL_AE_STATE
92 */
93 public static final int CONTROL_AE_STATE_PRECAPTURE =5;
94
95 /**
96 * The list of faces detected in this capture. Available if face detection
97 * was enabled for this capture
98 */
Igor Murashkinb519cc52013-07-02 11:23:44 -070099 public static final Key<Face[]> STATISTICS_DETECTED_FACES =
100 new Key<Face[]>("android.statistics.faces", Face[].class);
Eino-Ville Talvalab2675542012-12-12 13:29:45 -0800101
102 // TODO: Many many more
103
Igor Murashkin70725502013-06-25 20:27:06 +0000104 /**
105 * @hide
106 */
107 public CaptureResult() {
Eino-Ville Talvalab2675542012-12-12 13:29:45 -0800108 }
109
110 /**
111 * Describes a face detected in an image.
112 */
113 public static class Face {
114
115 /**
116 * <p>Bounds of the face. A rectangle relative to the sensor's
117 * {@link CameraProperties#SENSOR_ACTIVE_ARRAY_SIZE}, with (0,0)
118 * representing the top-left corner of the active array rectangle.</p>
119 */
120 public Rect getBounds() {
121 return mBounds;
122 }
123
124 /* <p>The confidence level for the detection of the face. The range is 1 to
125 * 100. 100 is the highest confidence.</p>
126 *
127 * <p>Depending on the device, even very low-confidence faces may be
128 * listed, so applications should filter out faces with low confidence,
129 * depending on the use case. For a typical point-and-shoot camera
130 * application that wishes to display rectangles around detected faces,
131 * filtering out faces with confidence less than 50 is recommended.</p>
132 *
133 */
134 public int getScore() {
135 return mScore;
136 }
137
138 /**
139 * An unique id per face while the face is visible to the tracker. If
140 * the face leaves the field-of-view and comes back, it will get a new
141 * id. This is an optional field, may not be supported on all devices.
142 * If not supported, id will always be set to -1. The optional fields
143 * are supported as a set. Either they are all valid, or none of them
144 * are.
145 */
146 public int getId() {
147 return mId;
148 }
149
150 /**
151 * The coordinates of the center of the left eye. The coordinates are in
152 * the same space as the ones for {@link #getBounds}. This is an
153 * optional field, may not be supported on all devices. If not
154 * supported, the value will always be set to null. The optional fields
155 * are supported as a set. Either they are all valid, or none of them
156 * are.
157 */
158 public Point getLeftEye() {
159 return mLeftEye;
160 }
161
162 /**
163 * The coordinates of the center of the right eye. The coordinates are
164 * in the same space as the ones for {@link #getBounds}.This is an
165 * optional field, may not be supported on all devices. If not
166 * supported, the value will always be set to null. The optional fields
167 * are supported as a set. Either they are all valid, or none of them
168 * are.
169 */
170 public Point getRightEye() {
171 return mRightEye;
172 }
173
174 /**
175 * The coordinates of the center of the mouth. The coordinates are in
176 * the same space as the ones for {@link #getBounds}. This is an optional
177 * field, may not be supported on all devices. If not supported, the
178 * value will always be set to null. The optional fields are supported
179 * as a set. Either they are all valid, or none of them are.
180 */
181 public Point getMouth() {
182 return mMouth;
183 }
184
185 private Rect mBounds;
186 private int mScore;
187 private int mId;
188 private Point mLeftEye;
189 private Point mRightEye;
190 private Point mMouth;
191 }
192}