OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // Private API for communicating with and receiving real-time media perception | |
6 // information from an computer vision + machine intelligence binary. | |
7 [implemented_in = "extensions/browser/api/media_perception_private/media_percept ion_private_api.h"] | |
tbarzic
2017/04/27 20:37:36
this is chromeos only, right?
can you add
platform
Luke Sorenson
2017/05/03 23:56:07
Done.
| |
8 | |
9 namespace mediaPerceptionPrivate { | |
10 enum Status { | |
11 ERROR, // An error occurred that needs to be propagated to the frontend. | |
tbarzic
2017/04/27 20:37:36
Can you put the comments above the values?
Also, I
Luke Sorenson
2017/05/03 23:56:07
Done.
| |
12 TIMEOUT, // Unable to reach media analysis process. | |
13 UNINITIALIZED, // Media analytics process waiting to be started. | |
14 STARTED, // Analysis process running but not recieving frames. | |
15 RUNNING, // Analysis process running and injesting frames. | |
16 SUSPENDED | |
17 }; | |
18 | |
19 // The system and configuration state of the analysis process and v4lplugin. | |
20 dictionary State { | |
21 Status? status; | |
22 // Optionally add device context to setState command for starting | |
23 // media analytics process, so that the media analytics process can | |
24 // better select the right video device to open. | |
25 DOMString? deviceContext; | |
26 }; | |
27 | |
28 dictionary Point { | |
29 // x represents the horizontal distance from the top left corner of the | |
30 // image to the point. | |
31 double? x; | |
32 // y represents the vertical distance from the top left corner of the | |
33 // image to the point. | |
34 double? y; | |
35 }; | |
36 | |
37 dictionary BoundingBox { | |
38 // Specifies whether the points are normalized to the size of the image. | |
39 // If not set, the points are not normalized. | |
40 boolean? normalized; | |
41 // The two points that define the corners of a bounding box. | |
42 Point? topLeft; | |
43 Point? bottomRight; | |
44 }; | |
45 | |
46 enum EntityType { | |
47 UNSPECIFIED, | |
48 FACE, | |
49 PERSON | |
50 }; | |
51 | |
52 dictionary Entity { | |
53 // A unique id associated with the detected entity, which can be used to | |
54 // track the entity over time. | |
55 long? id; | |
56 | |
57 EntityType? type; | |
58 | |
59 // Minimum box which captures entire detected entity. | |
60 BoundingBox? boundingBox; | |
61 | |
62 // A value for the quality of this detection. | |
63 double? confidence; | |
64 }; | |
65 | |
66 // The set of computer vision metadata for an image frame. | |
67 dictionary FramePerception { | |
68 long? frameId; | |
69 | |
70 long? frameWidthInPx; | |
71 long? frameHeightInPx; | |
72 // The timestamp associated with the frame (when its recieved by the | |
73 // analysis process). | |
74 double? timestamp; | |
75 | |
76 // The list of entities detected in this frame. | |
77 Entity[]? entities; | |
78 }; | |
79 | |
80 dictionary MediaPerception { | |
81 // The timestamp attached with when this data originated from the analysis | |
82 // process. | |
83 double? timestamp; | |
84 // A single framePerception or possibly array of framePerceptions. | |
tbarzic
2017/04/27 20:37:36
The type indicates that this will always be an arr
Luke Sorenson
2017/05/03 23:56:07
Done.
| |
85 FramePerception[]? framePerceptions; | |
86 }; | |
87 | |
88 dictionary ImageFrame { | |
89 long? width; | |
90 long? height; | |
91 // colorspace is defined in the same way as SimpleImage::ColorSpace. | |
tbarzic
2017/04/27 20:37:36
What's SimpleImage?
Luke Sorenson
2017/05/03 23:56:07
It's a class defined within google3, this entire d
| |
92 long? colorspace; | |
93 // By default, 1 channel means Grayscale, 2 channels meangs Grayscale + Alph a, | |
tbarzic
2017/04/27 20:37:36
Can the meaning of these values be different in an
Luke Sorenson
2017/05/03 23:56:07
See above comment, this dictionary is not final an
| |
94 // 3 channels means RGB, and 4 channels means RGBA. | |
95 long? channels; | |
96 // TODO(lasoren): Add compression format marker. | |
97 // The bytes of the image frame. | |
98 ArrayBuffer? frame; | |
99 }; | |
100 | |
101 dictionary PerceptionSample { | |
102 // The video analytics FramePerception for the associated image frame | |
103 // data. | |
104 FramePerception? framePerception; | |
105 // The image frame data for the associated FramePerception object. | |
106 ImageFrame? imageFrame; | |
107 }; | |
108 | |
109 dictionary Diagnostics { | |
110 // A buffer of image frames and the associated video analytics to be sent | |
111 // for diagnostics (when a user reports malfunction). | |
112 PerceptionSample[]? perceptionSamples; | |
113 }; | |
114 | |
115 callback StateCallback = void(State state); | |
116 | |
117 callback DiagnosticsCallback = void(Diagnostics diagnostics); | |
118 | |
119 interface Functions { | |
120 // Get the status of the media perception process. | |
121 // |callback| : The current State of the system. | |
122 static void getState(StateCallback callback); | |
tbarzic
2017/04/27 20:37:36
nit: new line after methods
Luke Sorenson
2017/05/03 23:56:07
Done.
| |
123 // Set the desired state of the system. | |
124 // |state| : A dictionary with the desired new state. | |
125 // |callback| : The State of the system after setting it. Verifies that | |
126 // the state was set as desired. | |
127 static void setState(State state, StateCallback callback); | |
tbarzic
2017/04/27 20:37:36
So, what would be the meaning of calling setState(
fraz
2017/05/02 21:57:29
The only accestable setState values for State shou
Luke Sorenson
2017/05/03 23:56:07
Echoing what Matt said, we prefer our API to SetSt
tbarzic
2017/05/05 21:10:40
Yes, having this generic setState is fine with me
Luke Sorenson
2017/05/08 19:06:06
I expect that the settable states will almost cert
| |
128 // Get a diagnostics buffer out of the video analytics process. | |
129 // |callback| : Returns a Diagnostics dictionary object which | |
130 // contains image frame data and associated detections to be logged. | |
131 static void getDiagnostics(DiagnosticsCallback callback); | |
132 }; | |
133 | |
134 interface Events { | |
135 // Fired when the analysis process has passed back to Chrome the current | |
136 // mediaPerception information. | |
137 // |mediaPerception| : The dictionary which contains a dump of everything | |
138 // the analysis process has detected or determined from the incoming media | |
139 // streams. | |
140 static void onMediaPerception(MediaPerception mediaPerception); | |
141 }; | |
142 }; | |
OLD | NEW |