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 receiving real-time media perception information. |
| 6 [platforms=("chromeos")] |
| 7 namespace mediaPerceptionPrivate { |
| 8 enum Status { |
| 9 // The media analytics process is waiting to be launched. |
| 10 UNINITIALIZED, |
| 11 |
| 12 // The analytics process is running and the media processing pipeline is |
| 13 // started, but it is not yet receiving image frames. This is a |
| 14 // transitional state between SUSPENDED and RUNNING for the time it takes |
| 15 // to warm up the media processing pipeline, which can take anywhere from |
| 16 // a few seconds to a minute. |
| 17 // Note: STARTED is the initial reply to SetState RUNNING. |
| 18 STARTED, |
| 19 |
| 20 // The analytics process is running and the media processing pipeling is |
| 21 // injesting image frames. At this point, MediaPerception signals should |
| 22 // be coming over D-Bus. |
| 23 RUNNING, |
| 24 |
| 25 // Analytics process is running and the media processing pipeline is ready |
| 26 // to be set to state RUNNING. The D-Bus communications are enabled but |
| 27 // the media processing pipeline is suspended. |
| 28 SUSPENDED |
| 29 }; |
| 30 |
| 31 // The system and configuration state of the analytics process and v4lplugin. |
| 32 dictionary State { |
| 33 Status status; |
| 34 |
| 35 // Optional $(ref:setState) parameter. Specifies the video device the media |
| 36 // analytics process should open while the media processing pipeline is |
| 37 // starting. To set this parameter, status has to be RUNNING. |
| 38 DOMString? deviceContext; |
| 39 }; |
| 40 |
| 41 dictionary Point { |
| 42 // The horizontal distance from the top left corner of the image. |
| 43 double? x; |
| 44 |
| 45 // The vertical distance from the top left corner of the image. |
| 46 double? y; |
| 47 }; |
| 48 |
| 49 dictionary BoundingBox { |
| 50 // Specifies whether the points are normalized to the size of the image. |
| 51 boolean? normalized; |
| 52 |
| 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; |
| 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 // The estimated depth of the entity from the camera. |
| 78 double? depthInMeters; |
| 79 }; |
| 80 |
| 81 // The set of computer vision metadata for an image frame. |
| 82 dictionary FramePerception { |
| 83 long? frameId; |
| 84 |
| 85 long? frameWidthInPx; |
| 86 long? frameHeightInPx; |
| 87 |
| 88 // The timestamp associated with the frame (when its recieved by the |
| 89 // analytics process). |
| 90 double? timestamp; |
| 91 |
| 92 // The list of entities detected in this frame. |
| 93 Entity[]? entities; |
| 94 }; |
| 95 |
| 96 dictionary MediaPerception { |
| 97 // The time the media perception data was emitted by the media processing |
| 98 // pipeline. This value will be greater than the timestamp stored within |
| 99 // the FramePerception dictionary and the difference between them can be |
| 100 // viewed as the processing time for a single frame. |
| 101 double? timestamp; |
| 102 |
| 103 // An array of framePerceptions. |
| 104 FramePerception[]? framePerceptions; |
| 105 }; |
| 106 |
| 107 enum ImageFormat { |
| 108 // Image represented by RGB data channels. |
| 109 RAW, |
| 110 PNG, |
| 111 JPEG |
| 112 }; |
| 113 |
| 114 dictionary ImageFrame { |
| 115 long? width; |
| 116 long? height; |
| 117 |
| 118 ImageFormat? format; |
| 119 |
| 120 long? dataLength; |
| 121 |
| 122 // The bytes of the image frame. |
| 123 ArrayBuffer? frame; |
| 124 }; |
| 125 |
| 126 dictionary PerceptionSample { |
| 127 // The video analytics FramePerception for the associated image frame |
| 128 // data. |
| 129 FramePerception? framePerception; |
| 130 |
| 131 // The image frame data for the associated FramePerception object. |
| 132 ImageFrame? imageFrame; |
| 133 }; |
| 134 |
| 135 dictionary Diagnostics { |
| 136 // A buffer of image frames and the associated video analytics information |
| 137 // that can be used to diagnose a malfunction. |
| 138 PerceptionSample[]? perceptionSamples; |
| 139 }; |
| 140 |
| 141 callback StateCallback = void(State state); |
| 142 |
| 143 callback DiagnosticsCallback = void(Diagnostics diagnostics); |
| 144 |
| 145 interface Functions { |
| 146 // Gets the status of the media perception process. |
| 147 // |callback| : The current state of the system. |
| 148 static void getState(StateCallback callback); |
| 149 |
| 150 // Sets the desired state of the system. |
| 151 // |state| : A dictionary with the desired new state. The only settable |
| 152 // states are RUNNING and SUSPENDED. |
| 153 // |callback| : Invoked with the State of the system after setting it. Can |
| 154 // be used to verify the state was set as desired. |
| 155 static void setState(State state, StateCallback callback); |
| 156 |
| 157 // Get a diagnostics buffer out of the video analytics process. |
| 158 // |callback| : Returns a Diagnostics dictionary object. |
| 159 static void getDiagnostics(DiagnosticsCallback callback); |
| 160 }; |
| 161 |
| 162 interface Events { |
| 163 // Fired when media perception information is received from the media |
| 164 // analytics process. |
| 165 // |mediaPerception| : The dictionary which contains a dump of everything |
| 166 // the analytics process has detected or determined from the incoming media |
| 167 // streams. |
| 168 static void onMediaPerception(MediaPerception mediaPerception); |
| 169 }; |
| 170 }; |
OLD | NEW |