blob: dd36f1d90f58cdd3453b92f2b5074fdf956ddfc2 [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 */
45 public static final Key SENSOR_TIMESTAMP =
46 new Key<Long>("android.sensor.timestamp");
47
48 /**
49 * The state of the camera device's auto-exposure algorithm. One of the
50 * CONTROL_AE_STATE_* enumerations.
51 */
52 public static final Key CONTROL_AE_STATE =
53 new Key<Integer>("android.control.aeState");
54
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 */
99 public static final Key STATISTICS_DETECTED_FACES =
100 new Key<Face[]>("android.statistics.faces");
101
102 // TODO: Many many more
103
104 CaptureResult() {
105 }
106
107 /**
108 * Describes a face detected in an image.
109 */
110 public static class Face {
111
112 /**
113 * <p>Bounds of the face. A rectangle relative to the sensor's
114 * {@link CameraProperties#SENSOR_ACTIVE_ARRAY_SIZE}, with (0,0)
115 * representing the top-left corner of the active array rectangle.</p>
116 */
117 public Rect getBounds() {
118 return mBounds;
119 }
120
121 /* <p>The confidence level for the detection of the face. The range is 1 to
122 * 100. 100 is the highest confidence.</p>
123 *
124 * <p>Depending on the device, even very low-confidence faces may be
125 * listed, so applications should filter out faces with low confidence,
126 * depending on the use case. For a typical point-and-shoot camera
127 * application that wishes to display rectangles around detected faces,
128 * filtering out faces with confidence less than 50 is recommended.</p>
129 *
130 */
131 public int getScore() {
132 return mScore;
133 }
134
135 /**
136 * An unique id per face while the face is visible to the tracker. If
137 * the face leaves the field-of-view and comes back, it will get a new
138 * id. This is an optional field, may not be supported on all devices.
139 * If not supported, id will always be set to -1. The optional fields
140 * are supported as a set. Either they are all valid, or none of them
141 * are.
142 */
143 public int getId() {
144 return mId;
145 }
146
147 /**
148 * The coordinates of the center of the left eye. The coordinates are in
149 * the same space as the ones for {@link #getBounds}. This is an
150 * optional field, may not be supported on all devices. If not
151 * supported, the value will always be set to null. The optional fields
152 * are supported as a set. Either they are all valid, or none of them
153 * are.
154 */
155 public Point getLeftEye() {
156 return mLeftEye;
157 }
158
159 /**
160 * The coordinates of the center of the right eye. The coordinates are
161 * in the same space as the ones for {@link #getBounds}.This is an
162 * optional field, may not be supported on all devices. If not
163 * supported, the value will always be set to null. The optional fields
164 * are supported as a set. Either they are all valid, or none of them
165 * are.
166 */
167 public Point getRightEye() {
168 return mRightEye;
169 }
170
171 /**
172 * The coordinates of the center of the mouth. The coordinates are in
173 * the same space as the ones for {@link #getBounds}. This is an optional
174 * field, may not be supported on all devices. If not supported, the
175 * value will always be set to null. The optional fields are supported
176 * as a set. Either they are all valid, or none of them are.
177 */
178 public Point getMouth() {
179 return mMouth;
180 }
181
182 private Rect mBounds;
183 private int mScore;
184 private int mId;
185 private Point mLeftEye;
186 private Point mRightEye;
187 private Point mMouth;
188 }
189}