supervision 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/dist/index.d.ts +12 -4
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +864 -127
  4. package/dist/index.js.map +1 -1
  5. package/dist/mask-preparation.worker.js +91 -59
  6. package/dist/mask-preparation.worker.js.map +1 -1
  7. package/dist/media/media-errors.d.ts +32 -0
  8. package/dist/media/media-errors.d.ts.map +1 -0
  9. package/dist/media/media-source-state.d.ts.map +1 -1
  10. package/dist/media/media-stream-media-source.d.ts +31 -0
  11. package/dist/media/media-stream-media-source.d.ts.map +1 -1
  12. package/dist/media/mediabunny-media-source.d.ts.map +1 -1
  13. package/dist/media/presentation-timeline-media-source.d.ts +17 -0
  14. package/dist/media/presentation-timeline-media-source.d.ts.map +1 -0
  15. package/dist/media/static-image-media-source.d.ts.map +1 -1
  16. package/dist/post-processing/default-tracking-worker.d.ts +3 -0
  17. package/dist/post-processing/default-tracking-worker.d.ts.map +1 -0
  18. package/dist/post-processing/detection-post-processing-pipeline.d.ts +7 -0
  19. package/dist/post-processing/detection-post-processing-pipeline.d.ts.map +1 -0
  20. package/dist/post-processing/embedded-tracking-worker.d.ts +2 -0
  21. package/dist/post-processing/embedded-tracking-worker.d.ts.map +1 -0
  22. package/dist/post-processing/tracking-worker-protocol.d.ts +29 -0
  23. package/dist/post-processing/tracking-worker-protocol.d.ts.map +1 -0
  24. package/dist/post-processing/tracking.worker.d.ts +2 -0
  25. package/dist/post-processing/tracking.worker.d.ts.map +1 -0
  26. package/dist/renderers/media-renderer-core.d.ts.map +1 -1
  27. package/dist/renderers/media-renderer-state.d.ts.map +1 -1
  28. package/dist/sessions/media-session-detections.d.ts.map +1 -1
  29. package/dist/sessions/media-session.d.ts +2 -2
  30. package/dist/sessions/media-session.d.ts.map +1 -1
  31. package/dist/tracking.worker.js +1509 -0
  32. package/dist/tracking.worker.js.map +1 -0
  33. package/dist/types/detection-post-processing.d.ts +62 -0
  34. package/dist/types/detection-post-processing.d.ts.map +1 -0
  35. package/dist/types/media-session.d.ts +57 -1
  36. package/dist/types/media-session.d.ts.map +1 -1
  37. package/dist/workers/worker-rpc-client.d.ts +2 -1
  38. package/dist/workers/worker-rpc-client.d.ts.map +1 -1
  39. package/node_modules/supervision-js-core/dist/detections/composite-detection-frame-source.d.ts.map +1 -1
  40. package/node_modules/supervision-js-core/dist/detections/memory-cold-detection-frame-store.d.ts.map +1 -1
  41. package/node_modules/supervision-js-core/dist/detections/projected-detection-frame-source.d.ts +22 -0
  42. package/node_modules/supervision-js-core/dist/detections/projected-detection-frame-source.d.ts.map +1 -0
  43. package/node_modules/supervision-js-core/dist/detections/writable-detection-frame-source.d.ts +2 -7
  44. package/node_modules/supervision-js-core/dist/detections/writable-detection-frame-source.d.ts.map +1 -1
  45. package/node_modules/supervision-js-core/dist/index.d.ts +11 -3
  46. package/node_modules/supervision-js-core/dist/index.d.ts.map +1 -1
  47. package/node_modules/supervision-js-core/dist/index.js +2289 -329
  48. package/node_modules/supervision-js-core/dist/index.js.map +1 -1
  49. package/node_modules/supervision-js-core/dist/post-processing/byte-track-tracker.d.ts +4 -0
  50. package/node_modules/supervision-js-core/dist/post-processing/byte-track-tracker.d.ts.map +1 -0
  51. package/node_modules/supervision-js-core/dist/post-processing/cbiou-tracker.d.ts +4 -0
  52. package/node_modules/supervision-js-core/dist/post-processing/cbiou-tracker.d.ts.map +1 -0
  53. package/node_modules/supervision-js-core/dist/post-processing/oc-sort-tracker.d.ts +4 -0
  54. package/node_modules/supervision-js-core/dist/post-processing/oc-sort-tracker.d.ts.map +1 -0
  55. package/node_modules/supervision-js-core/dist/post-processing/sort-tracker.d.ts +4 -0
  56. package/node_modules/supervision-js-core/dist/post-processing/sort-tracker.d.ts.map +1 -0
  57. package/node_modules/supervision-js-core/dist/post-processing/tracking.d.ts +9 -0
  58. package/node_modules/supervision-js-core/dist/post-processing/tracking.d.ts.map +1 -0
  59. package/node_modules/supervision-js-core/dist/types/detection-timeline.d.ts +113 -3
  60. package/node_modules/supervision-js-core/dist/types/detection-timeline.d.ts.map +1 -1
  61. package/node_modules/supervision-js-core/dist/types/detections.d.ts +33 -3
  62. package/node_modules/supervision-js-core/dist/types/detections.d.ts.map +1 -1
  63. package/node_modules/supervision-js-core/dist/types/media-rendering.d.ts +31 -0
  64. package/node_modules/supervision-js-core/dist/types/media-rendering.d.ts.map +1 -1
  65. package/node_modules/supervision-js-core/dist/types/post-processing.d.ts +148 -0
  66. package/node_modules/supervision-js-core/dist/types/post-processing.d.ts.map +1 -0
  67. package/node_modules/supervision-js-core/dist/utils/detection-frames.d.ts.map +1 -1
  68. package/node_modules/supervision-js-core/dist/utils/detection-projection.d.ts +20 -0
  69. package/node_modules/supervision-js-core/dist/utils/detection-projection.d.ts.map +1 -0
  70. package/node_modules/supervision-js-core/package.json +12 -5
  71. package/package.json +7 -2
@@ -138,22 +138,56 @@
138
138
  AnnotationFrameMutationKind["Update"] = "update";
139
139
  })(AnnotationFrameMutationKind || (AnnotationFrameMutationKind = {}));
140
140
 
141
- var DetectionPickTarget;
142
- (function (DetectionPickTarget) {
143
- DetectionPickTarget["Box"] = "box";
144
- DetectionPickTarget["Edge"] = "edge";
145
- DetectionPickTarget["Keypoint"] = "keypoint";
146
- DetectionPickTarget["Label"] = "label";
147
- DetectionPickTarget["Mask"] = "mask";
148
- DetectionPickTarget["Polygon"] = "polygon";
149
- DetectionPickTarget["Polyline"] = "polyline";
150
- })(DetectionPickTarget || (DetectionPickTarget = {}));
151
- var MediaInteractionMode;
152
- (function (MediaInteractionMode) {
153
- MediaInteractionMode["Always"] = "always";
154
- MediaInteractionMode["Disabled"] = "disabled";
155
- MediaInteractionMode["PausedOnly"] = "pausedOnly";
156
- })(MediaInteractionMode || (MediaInteractionMode = {}));
141
+ /** Geometry projected into a tracker. The original detection payload is retained. */
142
+ var TrackingGeometry;
143
+ (function (TrackingGeometry) {
144
+ TrackingGeometry["Box"] = "box";
145
+ TrackingGeometry["Mask"] = "mask";
146
+ TrackingGeometry["Keypoints"] = "keypoints";
147
+ })(TrackingGeometry || (TrackingGeometry = {}));
148
+
149
+ var DetectionMaskPayloadFormat;
150
+ (function (DetectionMaskPayloadFormat) {
151
+ DetectionMaskPayloadFormat["RawCocoRle"] = "rawCocoRle";
152
+ DetectionMaskPayloadFormat["DeflatedBase64"] = "deflatedBase64";
153
+ })(DetectionMaskPayloadFormat || (DetectionMaskPayloadFormat = {}));
154
+ function encodeBinaryMask(data, width, height) {
155
+ assertMaskDimensions(data, width, height);
156
+ const runs = [];
157
+ let currentValue = 0;
158
+ let runLength = 0;
159
+ for (let x = 0; x < width; x += 1) {
160
+ for (let y = 0; y < height; y += 1) {
161
+ const value = data[y * width + x] ? 1 : 0;
162
+ if (value === currentValue) {
163
+ runLength += 1;
164
+ }
165
+ else {
166
+ runs.push(runLength);
167
+ currentValue = value;
168
+ runLength = 1;
169
+ }
170
+ }
171
+ }
172
+ runs.push(runLength);
173
+ return {
174
+ counts: encodeCompressedRleCounts(runs),
175
+ encoding: DetectionMaskEncoding.CompressedRle,
176
+ height,
177
+ width,
178
+ };
179
+ }
180
+ function assertMaskDimensions(data, width, height) {
181
+ if (!Number.isInteger(width) || width <= 0) {
182
+ throw new Error("Mask width must be a positive integer.");
183
+ }
184
+ if (!Number.isInteger(height) || height <= 0) {
185
+ throw new Error("Mask height must be a positive integer.");
186
+ }
187
+ if (data.length !== width * height) {
188
+ throw new Error("Mask data length must equal width * height.");
189
+ }
190
+ }
157
191
 
158
192
  function centerRectToTopLeftRect(rect) {
159
193
  return {
@@ -185,6 +219,23 @@
185
219
  };
186
220
  }
187
221
 
222
+ var DetectionPickTarget;
223
+ (function (DetectionPickTarget) {
224
+ DetectionPickTarget["Box"] = "box";
225
+ DetectionPickTarget["Edge"] = "edge";
226
+ DetectionPickTarget["Keypoint"] = "keypoint";
227
+ DetectionPickTarget["Label"] = "label";
228
+ DetectionPickTarget["Mask"] = "mask";
229
+ DetectionPickTarget["Polygon"] = "polygon";
230
+ DetectionPickTarget["Polyline"] = "polyline";
231
+ })(DetectionPickTarget || (DetectionPickTarget = {}));
232
+ var MediaInteractionMode;
233
+ (function (MediaInteractionMode) {
234
+ MediaInteractionMode["Always"] = "always";
235
+ MediaInteractionMode["Disabled"] = "disabled";
236
+ MediaInteractionMode["PausedOnly"] = "pausedOnly";
237
+ })(MediaInteractionMode || (MediaInteractionMode = {}));
238
+
188
239
  var AnnotationGeometryKind;
189
240
  (function (AnnotationGeometryKind) {
190
241
  AnnotationGeometryKind["Box"] = "box";
@@ -289,49 +340,6 @@
289
340
  KeypointMarkerShape["Circle"] = "circle";
290
341
  KeypointMarkerShape["Cross"] = "cross";
291
342
  })(KeypointMarkerShape || (KeypointMarkerShape = {}));
292
-
293
- var DetectionMaskPayloadFormat;
294
- (function (DetectionMaskPayloadFormat) {
295
- DetectionMaskPayloadFormat["RawCocoRle"] = "rawCocoRle";
296
- DetectionMaskPayloadFormat["DeflatedBase64"] = "deflatedBase64";
297
- })(DetectionMaskPayloadFormat || (DetectionMaskPayloadFormat = {}));
298
- function encodeBinaryMask(data, width, height) {
299
- assertMaskDimensions(data, width, height);
300
- const runs = [];
301
- let currentValue = 0;
302
- let runLength = 0;
303
- for (let x = 0; x < width; x += 1) {
304
- for (let y = 0; y < height; y += 1) {
305
- const value = data[y * width + x] ? 1 : 0;
306
- if (value === currentValue) {
307
- runLength += 1;
308
- }
309
- else {
310
- runs.push(runLength);
311
- currentValue = value;
312
- runLength = 1;
313
- }
314
- }
315
- }
316
- runs.push(runLength);
317
- return {
318
- counts: encodeCompressedRleCounts(runs),
319
- encoding: DetectionMaskEncoding.CompressedRle,
320
- height,
321
- width,
322
- };
323
- }
324
- function assertMaskDimensions(data, width, height) {
325
- if (!Number.isInteger(width) || width <= 0) {
326
- throw new Error("Mask width must be a positive integer.");
327
- }
328
- if (!Number.isInteger(height) || height <= 0) {
329
- throw new Error("Mask height must be a positive integer.");
330
- }
331
- if (data.length !== width * height) {
332
- throw new Error("Mask data length must equal width * height.");
333
- }
334
- }
335
343
  function rasterizePolygonToMask(points, dimensions) {
336
344
  const data = createEmptyMask(dimensions);
337
345
  if (points.length < 3) {
@@ -454,6 +462,30 @@
454
462
  MediaRendererPlaybackState["Error"] = "error";
455
463
  MediaRendererPlaybackState["Destroyed"] = "destroyed";
456
464
  })(MediaRendererPlaybackState || (MediaRendererPlaybackState = {}));
465
+ /**
466
+ * Stable classification of a media failure.
467
+ *
468
+ * Applications branch on these kinds instead of parsing decoder, demuxer, or
469
+ * container error text, and still own their localized user-facing copy. New
470
+ * kinds may be added over time, so treat unrecognized values like `Unknown`.
471
+ */
472
+ var MediaErrorKind;
473
+ (function (MediaErrorKind) {
474
+ /** The media could not be opened or read at all. */
475
+ MediaErrorKind["Unreadable"] = "unreadable";
476
+ /** The container or codec is not supported by this platform. */
477
+ MediaErrorKind["UnsupportedFormat"] = "unsupportedFormat";
478
+ /** The media opened but carries no usable video track. */
479
+ MediaErrorKind["NoVideoTrack"] = "noVideoTrack";
480
+ /** Decoding a sample failed after the source opened. */
481
+ MediaErrorKind["Decode"] = "decode";
482
+ /** The media could not be fetched. */
483
+ MediaErrorKind["Network"] = "network";
484
+ /** The host environment lacks the APIs this media source requires. */
485
+ MediaErrorKind["EnvironmentUnsupported"] = "environmentUnsupported";
486
+ /** The failure could not be classified. */
487
+ MediaErrorKind["Unknown"] = "unknown";
488
+ })(MediaErrorKind || (MediaErrorKind = {}));
457
489
  /**
458
490
  * Lower-level media source readiness.
459
491
  */