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 | |
tbarzic
2017/05/08 22:21:07
Private API for receiving real-time media percepti
Luke Sorenson
2017/05/09 17:41:05
Done.
| |
6 // information from an computer vision + machine intelligence binary. | |
7 [platforms=("chromeos")] | |
8 | |
tbarzic
2017/05/08 22:21:07
nit: no new line
Luke Sorenson
2017/05/09 17:41:05
Done.
| |
9 namespace mediaPerceptionPrivate { | |
10 enum Status { | |
11 // An error occurred. | |
12 ERROR, | |
13 | |
14 // Unable to reach media analysis process. | |
tbarzic
2017/05/08 22:21:08
Attempt to reach media analysis process failed.
Luke Sorenson
2017/05/09 17:41:05
Done.
| |
15 TIMEOUT, | |
16 | |
17 // Media analytics process waiting to be launched. | |
18 UNINITIALIZED, | |
19 | |
20 // Analysis process running but is not yet receiving image frames. This is | |
21 // a transitional state between SUSPENDED and RUNNING, for the time it | |
22 // takes to warm up the media analysis pipeline. | |
23 STARTED, | |
24 | |
25 // Analysis process running and injesting image frames. At this point, | |
26 // MediaPerception signals should be coming over D-Bus. | |
27 RUNNING, | |
28 | |
29 // Analysis process is running and ready to be set to state RUNNING. | |
tbarzic
2017/05/08 22:21:07
How about "Media analytics process is running, but
Luke Sorenson
2017/05/09 17:41:05
I added more clarifying comments to try to help ma
| |
30 SUSPENDED | |
31 }; | |
32 | |
33 // The system and configuration state of the analysis process and v4lplugin. | |
34 dictionary State { | |
35 Status? status; | |
tbarzic
2017/05/08 22:21:07
So, if understand this correctly, status will alwa
Luke Sorenson
2017/05/09 17:41:05
Done.
| |
36 // Optionally add device context to setState command for starting | |
37 // media analytics process, so that the media analytics process can | |
38 // better select the right video device to open. Provide this value with | |
39 // status RUNNING when the process is currently in an UNINITIALIZED or | |
40 // SUSPENDED state. | |
41 DOMString? deviceContext; | |
42 }; | |
43 | |
44 dictionary Point { | |
45 // The horizontal distance from the top left corner of the image. | |
46 double? x; | |
tbarzic
2017/05/08 22:21:07
It feels a little weird that the API allows a poin
Luke Sorenson
2017/05/09 17:41:05
We will be careful to always check that a value ex
| |
47 // The vertical distance from the top left corner of the image. | |
48 double? y; | |
49 }; | |
50 | |
51 dictionary BoundingBox { | |
52 // Specifies whether the points are normalized to the size of the image. | |
53 boolean? normalized; | |
54 // The two points that define the corners of a bounding box. | |
55 Point? topLeft; | |
56 Point? bottomRight; | |
57 }; | |
58 | |
59 enum EntityType { | |
60 UNSPECIFIED, | |
61 FACE, | |
62 PERSON | |
63 }; | |
64 | |
65 dictionary Entity { | |
66 // A unique id associated with the detected entity, which can be used to | |
67 // track the entity over time. | |
68 long? id; | |
69 | |
70 EntityType? type; | |
71 | |
72 // Minimum box which captures entire detected entity. | |
73 BoundingBox? boundingBox; | |
74 | |
75 // A value for the quality of this detection. | |
76 double? confidence; | |
77 }; | |
78 | |
79 // The set of computer vision metadata for an image frame. | |
80 dictionary FramePerception { | |
81 long? frameId; | |
82 | |
83 long? frameWidthInPx; | |
84 long? frameHeightInPx; | |
85 // The timestamp associated with the frame (when its recieved by the | |
86 // analysis process). | |
87 double? timestamp; | |
88 | |
89 // The list of entities detected in this frame. | |
90 Entity[]? entities; | |
91 }; | |
92 | |
93 dictionary MediaPerception { | |
94 // The timestamp attached with when this data originated from the analysis | |
tbarzic
2017/05/08 22:21:07
nit: The time the media perception data was emitte
Luke Sorenson
2017/05/09 17:41:05
Done.
| |
95 // process. This value will be greater than the timestamp stored within the | |
96 // FramePerception dictionary and the difference between them can be viewed | |
97 // as the processing time for a single frame. | |
98 double? timestamp; | |
99 // An array of framePerceptions, often just one. | |
100 FramePerception[]? framePerceptions; | |
101 }; | |
102 | |
103 // TODO(lasoren): Change this interface based on the compressed images coming | |
104 // from the media analytics process. | |
tbarzic
2017/05/08 22:21:07
the comments keep switching between using analytic
Luke Sorenson
2017/05/09 17:41:05
Done.
| |
105 dictionary ImageFrame { | |
106 long? width; | |
107 long? height; | |
108 | |
109 // TODO(lasoren): Add compression format marker. | |
110 // The bytes of the image frame. | |
111 ArrayBuffer? frame; | |
112 }; | |
113 | |
114 dictionary PerceptionSample { | |
115 // The video analytics FramePerception for the associated image frame | |
116 // data. | |
117 FramePerception? framePerception; | |
118 // The image frame data for the associated FramePerception object. | |
119 ImageFrame? imageFrame; | |
120 }; | |
121 | |
122 dictionary Diagnostics { | |
123 // A buffer of image frames and the associated video analytics to be sent | |
124 // for diagnostics (when a user reports malfunction). | |
tbarzic
2017/05/08 22:21:07
"to be sent" seems like the app implementation det
Luke Sorenson
2017/05/09 17:41:05
Done.
| |
125 PerceptionSample[]? perceptionSamples; | |
126 }; | |
127 | |
128 callback StateCallback = void(State state); | |
129 | |
130 callback DiagnosticsCallback = void(Diagnostics diagnostics); | |
131 | |
132 interface Functions { | |
133 // Get the status of the media perception process. | |
134 // |callback| : The current State of the system. | |
135 static void getState(StateCallback callback); | |
136 | |
137 // Set the desired state of the system. | |
138 // |state| : A dictionary with the desired new state. Settable states are | |
139 // RUNNING and SUSPENDED. | |
140 // |callback| : The State of the system after setting it. Verifies that | |
141 // the state was set as desired. | |
tbarzic
2017/05/08 22:21:07
nit: s/Verifies that/Can be used to verify/
Luke Sorenson
2017/05/09 17:41:05
Done.
| |
142 static void setState(State state, StateCallback callback); | |
143 | |
144 // Get a diagnostics buffer out of the video analytics process. | |
145 // |callback| : Returns a Diagnostics dictionary object which | |
146 // contains image frame data and associated detections to be logged. | |
tbarzic
2017/05/08 22:21:07
I think it's evident from other comments what the
Luke Sorenson
2017/05/09 17:41:04
Done.
| |
147 static void getDiagnostics(DiagnosticsCallback callback); | |
148 }; | |
149 | |
150 interface Events { | |
151 // Fired when the analysis process has passed back to Chrome the current | |
tbarzic
2017/05/08 22:21:07
"Fired when media perception information is receiv
Luke Sorenson
2017/05/09 17:41:05
Done.
| |
152 // mediaPerception information. | |
153 // |mediaPerception| : The dictionary which contains a dump of everything | |
154 // the analysis process has detected or determined from the incoming media | |
155 // streams. | |
156 static void onMediaPerception(MediaPerception mediaPerception); | |
157 }; | |
158 }; | |
OLD | NEW |