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"] |
| 8 |
| 9 namespace mediaPerceptionPrivate { |
| 10 enum Status { |
| 11 UNKNOWN_ERROR, |
| 12 TIMEOUT, // Unable to reach media analysis process. |
| 13 INITIALIZED, // Analysis process running but not recieving frames. |
| 14 RUNNING, // Analysis process running and injesting frames. |
| 15 SUSPENDED |
| 16 }; |
| 17 |
| 18 // The system and configuration state of the analysis process and v4lplugin. |
| 19 dictionary State { |
| 20 Status? status; |
| 21 }; |
| 22 |
| 23 dictionary Point { |
| 24 // x represents the horizontal distance from the top left corner of the |
| 25 // image to the point. |
| 26 double? x; |
| 27 // y represents the vertical distance from the top left corner of the |
| 28 // image to the point. |
| 29 double? y; |
| 30 }; |
| 31 |
| 32 dictionary BoundingBox { |
| 33 // The two points that define the corners of a bounding box. |
| 34 Point? topLeft; |
| 35 Point? bottomRight; |
| 36 }; |
| 37 |
| 38 enum EntityType { |
| 39 UNSPECIFIED, |
| 40 FACE, |
| 41 PERSON |
| 42 }; |
| 43 |
| 44 dictionary Entity { |
| 45 // A unique id associated with the detected entity, which can be used to tra
ck |
| 46 // the entity over time. |
| 47 long? entityId; |
| 48 |
| 49 EntityType? entityType; |
| 50 // Marks whether this entity is believed to be currently occluded. Likely |
| 51 // wasn't detected in this frame but still has a bounding box. |
| 52 boolean? occluded; |
| 53 // Marks whether this entity is believed to be outside of frame. Was not |
| 54 // detected in this frame and does not have a bounding box. |
| 55 boolean? outside; |
| 56 |
| 57 // The estimated depth of the entity in meters. |
| 58 double? estimatedDepthInMeters; |
| 59 |
| 60 // Minimum box which captures entire detected entity. |
| 61 BoundingBox? boundingBox; |
| 62 |
| 63 // A list of entity ids for associated entities. For example, a face entity |
| 64 // would point to the associated person and vice-versa. |
| 65 long[]? associatedEntities; |
| 66 }; |
| 67 |
| 68 // The set of computer vision metadata for an image frame. |
| 69 dictionary FramePerception { |
| 70 long? frameId; |
| 71 |
| 72 long? frameWidthInPx; |
| 73 long? frameHeightInPx; |
| 74 // The timestamp associated with the frame (when its recieved by the |
| 75 // analysis process). |
| 76 long? timestamp; |
| 77 |
| 78 // The list of entities detected in this frame. |
| 79 Entity[]? entities; |
| 80 }; |
| 81 |
| 82 dictionary MediaPerception { |
| 83 // The timestamp attached with when this data originated from the analysis |
| 84 // process. |
| 85 long? timestamp; |
| 86 // A single framePerception or possibly array of framePerceptions. |
| 87 (FramePerception or FramePerception[])? framePerceptions; |
| 88 }; |
| 89 |
| 90 callback StateCallback = void(State state); |
| 91 |
| 92 interface Functions { |
| 93 // Get the status of the media perception process. |
| 94 // |callback| : The current State of the system. |
| 95 static void getState(StateCallback callback); |
| 96 // Set the desired state of the system. |
| 97 // |state| : A dictionary with the desired new state. |
| 98 // |callback| : The State of the system after setting it. Verifies that |
| 99 // the state was set as desired. |
| 100 static void setState(State state, StateCallback callback); |
| 101 }; |
| 102 |
| 103 interface Events { |
| 104 // Fired when the analysis process has passed back to Chrome the current |
| 105 // mediaPerception information. |
| 106 // |mediaPerception| : The dictionary which contains a dump of everything |
| 107 // the analysis process has detected or determined from the incoming media |
| 108 // streams. |
| 109 static void onMediaPerception(MediaPerception mediaPerception); |
| 110 }; |
| 111 }; |
OLD | NEW |