Chromium Code Reviews| 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 [platforms=("chromeos"), | |
| 8 implemented_in = "extensions/browser/api/media_perception_private/media_percept ion_private_api.h"] | |
|
tbarzic
2017/05/05 21:10:41
I don't think you need this - this seems to be the
Luke Sorenson
2017/05/08 19:06:07
Done. In https://codereview.chromium.org/286020300
| |
| 9 | |
| 10 namespace mediaPerceptionPrivate { | |
| 11 enum Status { | |
| 12 // An error occurred that needs to be propagated to the frontend. | |
|
tbarzic
2017/05/05 21:10:41
I'd drop the "that needs to be propagated to the f
Luke Sorenson
2017/05/08 19:06:07
Done. In https://codereview.chromium.org/28602030
| |
| 13 ERROR, | |
| 14 | |
| 15 // Unable to reach media analysis process. | |
| 16 TIMEOUT, | |
| 17 | |
| 18 // Media analytics process waiting to be started. | |
| 19 UNINITIALIZED, | |
| 20 | |
| 21 // Analysis process running but not recieving frames. | |
|
tbarzic
2017/05/05 21:10:41
Can you explain the difference between STARTED/RUN
Luke Sorenson
2017/05/08 19:06:07
Done. In https://codereview.chromium.org/286020300
| |
| 22 STARTED, | |
| 23 | |
| 24 // Analysis process running and injesting frames. | |
| 25 RUNNING, | |
| 26 | |
| 27 // Analysis process ready to be set to state RUNNING. | |
| 28 SUSPENDED | |
| 29 }; | |
| 30 | |
| 31 // The system and configuration state of the analysis process and v4lplugin. | |
| 32 dictionary State { | |
| 33 Status? status; | |
| 34 // Optionally add device context to setState command for starting | |
| 35 // media analytics process, so that the media analytics process can | |
| 36 // better select the right video device to open. | |
| 37 DOMString? deviceContext; | |
|
tbarzic
2017/05/05 21:10:41
Is this allowed only with setState(RUNNING)?
I.e.
Luke Sorenson
2017/05/08 19:06:07
Providing device context is only meaningful with s
| |
| 38 }; | |
| 39 | |
| 40 dictionary Point { | |
| 41 // x represents the horizontal distance from the top left corner of the | |
|
tbarzic
2017/05/05 21:10:41
drop "x represents" and "to the point"
Luke Sorenson
2017/05/08 19:06:07
Done.
| |
| 42 // image to the point. | |
| 43 double? x; | |
| 44 // y represents the vertical distance from the top left corner of the | |
|
tbarzic
2017/05/05 21:10:41
drop "y represents" and "to the point"
Luke Sorenson
2017/05/08 19:06:06
Done.
| |
| 45 // image to the point. | |
| 46 double? y; | |
|
tbarzic
2017/05/05 21:10:41
This seems like a required value - can you go thro
Luke Sorenson
2017/05/08 19:06:07
Because many of these Dictionary definitions are b
| |
| 47 }; | |
| 48 | |
| 49 dictionary BoundingBox { | |
| 50 // Specifies whether the points are normalized to the size of the image. | |
| 51 // If not set, the points are not normalized. | |
|
tbarzic
2017/05/05 21:10:41
"If not set, the points are not normalized" seems
Luke Sorenson
2017/05/08 19:06:07
Done :) In https://codereview.chromium.org/2860203
| |
| 52 boolean? normalized; | |
| 53 // The two points that define the corners of a bounding box. | |
| 54 Point? topLeft; | |
| 55 Point? bottomRight; | |
| 56 }; | |
| 57 | |
| 58 enum EntityType { | |
| 59 UNSPECIFIED, | |
| 60 FACE, | |
| 61 PERSON | |
| 62 }; | |
| 63 | |
| 64 dictionary Entity { | |
| 65 // A unique id associated with the detected entity, which can be used to | |
| 66 // track the entity over time. | |
| 67 long? id; | |
|
tbarzic
2017/05/05 21:10:41
why is this optional?
Luke Sorenson
2017/05/08 19:06:07
See above explanation about decision to use only o
tbarzic
2017/05/08 23:04:55
My idea was closer to dropping nonsensical message
| |
| 68 | |
| 69 EntityType? type; | |
| 70 | |
| 71 // Minimum box which captures entire detected entity. | |
| 72 BoundingBox? boundingBox; | |
| 73 | |
| 74 // A value for the quality of this detection. | |
| 75 double? confidence; | |
| 76 }; | |
| 77 | |
| 78 // The set of computer vision metadata for an image frame. | |
| 79 dictionary FramePerception { | |
| 80 long? frameId; | |
| 81 | |
| 82 long? frameWidthInPx; | |
| 83 long? frameHeightInPx; | |
| 84 // The timestamp associated with the frame (when its recieved by the | |
| 85 // analysis process). | |
| 86 double? timestamp; | |
| 87 | |
| 88 // The list of entities detected in this frame. | |
| 89 Entity[]? entities; | |
| 90 }; | |
| 91 | |
| 92 dictionary MediaPerception { | |
| 93 // The timestamp attached with when this data originated from the analysis | |
| 94 // process. | |
|
tbarzic
2017/05/05 21:10:41
I'd comment on relationship to timestamps in frame
Luke Sorenson
2017/05/08 19:06:07
Done.
| |
| 95 double? timestamp; | |
| 96 // An array of framePerceptions, often just one. | |
| 97 FramePerception[]? framePerceptions; | |
| 98 }; | |
| 99 | |
| 100 // TODO(lasoren): Change this interface based on the compressed images coming | |
| 101 // from the media analytics process. | |
| 102 dictionary ImageFrame { | |
| 103 long? width; | |
| 104 long? height; | |
| 105 // colorspace is defined in the same way as SimpleImage::ColorSpace. | |
|
tbarzic
2017/05/05 21:10:41
I'd avoid referencing SimpleImage::ColorSpace here
Luke Sorenson
2017/05/08 19:06:07
Acknowledged.
| |
| 106 long? colorspace; | |
| 107 // By default, 1 channel means Grayscale, 2 channels meangs Grayscale + Alph a, | |
|
tbarzic
2017/05/05 21:10:41
So this is the number of channels? maybe rename it
Luke Sorenson
2017/05/08 19:06:06
For now, since we not yet sure how we'll be repres
| |
| 108 // 3 channels means RGB, and 4 channels means RGBA. | |
| 109 long? channels; | |
| 110 // TODO(lasoren): Add compression format marker. | |
| 111 // The bytes of the image frame. | |
| 112 ArrayBuffer? frame; | |
| 113 }; | |
| 114 | |
| 115 dictionary PerceptionSample { | |
| 116 // The video analytics FramePerception for the associated image frame | |
| 117 // data. | |
| 118 FramePerception? framePerception; | |
| 119 // The image frame data for the associated FramePerception object. | |
| 120 ImageFrame? imageFrame; | |
| 121 }; | |
| 122 | |
| 123 dictionary Diagnostics { | |
| 124 // A buffer of image frames and the associated video analytics to be sent | |
| 125 // for diagnostics (when a user reports malfunction). | |
| 126 PerceptionSample[]? perceptionSamples; | |
| 127 }; | |
| 128 | |
| 129 callback StateCallback = void(State state); | |
| 130 | |
| 131 callback DiagnosticsCallback = void(Diagnostics diagnostics); | |
| 132 | |
| 133 interface Functions { | |
| 134 // Get the status of the media perception process. | |
| 135 // |callback| : The current State of the system. | |
| 136 static void getState(StateCallback callback); | |
| 137 | |
| 138 // Set the desired state of the system. | |
| 139 // |state| : A dictionary with the desired new state. | |
| 140 // |callback| : The State of the system after setting it. Verifies that | |
| 141 // the state was set as desired. | |
| 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. | |
| 147 static void getDiagnostics(DiagnosticsCallback callback); | |
| 148 }; | |
| 149 | |
| 150 interface Events { | |
| 151 // Fired when the analysis process has passed back to Chrome the current | |
| 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 |