@viji-dev/core 0.4.5 → 0.5.0
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.
- package/dist/artist-dts-p5.js +1 -1
- package/dist/artist-dts.js +1 -1
- package/dist/artist-global-p5.d.ts +106 -48
- package/dist/artist-global.d.ts +106 -48
- package/dist/artist-jsdoc.d.ts +2 -6
- package/dist/assets/{viji.worker-D1yRmN8m.js → viji.worker-CWKkFyOs.js} +561 -168
- package/dist/assets/viji.worker-CWKkFyOs.js.map +1 -0
- package/dist/docs-api.js +9759 -9704
- package/dist/{essentia-wasm.web-BbdWO0Xs.js → essentia-wasm.web-CmPC-AKu.js} +2 -2
- package/dist/{essentia-wasm.web-BbdWO0Xs.js.map → essentia-wasm.web-CmPC-AKu.js.map} +1 -1
- package/dist/{index-DUg1Foui.js → index-Cp9G0z4E.js} +109 -11
- package/dist/index-Cp9G0z4E.js.map +1 -0
- package/dist/index.d.ts +106 -48
- package/dist/index.js +1 -1
- package/dist/shader-uniforms.js +10 -0
- package/package.json +98 -97
- package/dist/assets/viji.worker-D1yRmN8m.js.map +0 -1
- package/dist/index-DUg1Foui.js.map +0 -1
package/dist/artist-global.d.ts
CHANGED
|
@@ -1211,14 +1211,16 @@ declare global {
|
|
|
1211
1211
|
isEnding: boolean;
|
|
1212
1212
|
}
|
|
1213
1213
|
|
|
1214
|
-
const VERSION = "0.
|
|
1214
|
+
const VERSION = "0.5.0";
|
|
1215
1215
|
|
|
1216
1216
|
/**
|
|
1217
|
-
* Real-time video API: drawable frame, dimensions, and
|
|
1218
|
-
*
|
|
1217
|
+
* Real-time video API: drawable frame, dimensions, and the source-side
|
|
1218
|
+
* properties of the connected stream. All computer-vision data and controls
|
|
1219
|
+
* (faces, hands, pose, segmentation, the analysed frame, and feature
|
|
1220
|
+
* enable/disable verbs) live on `viji.video.cv`.
|
|
1219
1221
|
*
|
|
1220
|
-
* When `isConnected` is `false`, `currentFrame` is `null`, all dimensions are
|
|
1221
|
-
* and
|
|
1222
|
+
* When `isConnected` is `false`, `currentFrame` is `null`, all dimensions are
|
|
1223
|
+
* `0`, and every member of `cv` holds its empty default.
|
|
1222
1224
|
*/
|
|
1223
1225
|
interface VideoAPI {
|
|
1224
1226
|
/** `true` when a video stream is connected. When `false`, all other fields hold their default empty values. */
|
|
@@ -1237,6 +1239,70 @@ declare global {
|
|
|
1237
1239
|
* use only when you need to read individual pixel values.
|
|
1238
1240
|
*/
|
|
1239
1241
|
getFrameData: () => ImageData | null;
|
|
1242
|
+
/**
|
|
1243
|
+
* Computer-vision surface for this video stream. Holds both the data
|
|
1244
|
+
* outputs (`faces`, `hands`, `pose`, `segmentation`, `analysedFrame`,
|
|
1245
|
+
* `getAnalysedFrameData`) and the verbs that activate them
|
|
1246
|
+
* (`enable*`/`disable*`/`getActiveFeatures`/`isProcessing`).
|
|
1247
|
+
*
|
|
1248
|
+
* Multiple features can be active simultaneously, but each adds CPU/GPU
|
|
1249
|
+
* and WebGL-context cost — toggle only what you need.
|
|
1250
|
+
*
|
|
1251
|
+
* `analysedFrame` and the result fields refresh together once per host
|
|
1252
|
+
* frame (atomic snapshot) — within a single `render()` call they are
|
|
1253
|
+
* always paired.
|
|
1254
|
+
*/
|
|
1255
|
+
cv: VideoCVAPI;
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
/**
|
|
1259
|
+
* Computer-vision surface attached to a `VideoAPI`. Combines paired CV data
|
|
1260
|
+
* outputs (the analysed frame and its detection / segmentation results) with
|
|
1261
|
+
* the verbs that activate the underlying MediaPipe pipelines.
|
|
1262
|
+
*
|
|
1263
|
+
* Available only on the main video stream (`viji.video.cv`). Additional
|
|
1264
|
+
* streams (`viji.videoStreams[i].cv`) and device videos
|
|
1265
|
+
* (`viji.devices[i].video.cv`) do not run CV — their `cv` surface exists for
|
|
1266
|
+
* API consistency but the data fields stay at their empty defaults and the
|
|
1267
|
+
* `enable*` verbs are no-ops.
|
|
1268
|
+
*/
|
|
1269
|
+
interface VideoCVAPI {
|
|
1270
|
+
/**
|
|
1271
|
+
* The exact video frame that produced the current `faces` / `hands` /
|
|
1272
|
+
* `pose` / `segmentation` results — the frame MediaPipe actually analysed.
|
|
1273
|
+
* Use this (not `viji.video.currentFrame`) when overlaying pixel-precise
|
|
1274
|
+
* CV-driven effects (face-mesh masks, body-segmentation compositing,
|
|
1275
|
+
* makeup, distortion). `currentFrame` is the just-arrived frame and runs
|
|
1276
|
+
* ~15–40 ms ahead of the analysis; `analysedFrame` is the frame the
|
|
1277
|
+
* landmarks/mask actually correspond to, so the two stay locked under
|
|
1278
|
+
* fast head/body motion.
|
|
1279
|
+
*
|
|
1280
|
+
* Pairing guarantee: within a single `render()` call, `analysedFrame`
|
|
1281
|
+
* is paired with the values of `faces`, `hands`, `pose`, `segmentation`
|
|
1282
|
+
* you read in the same call. They refresh together once per host frame.
|
|
1283
|
+
*
|
|
1284
|
+
* `null` until the first CV inference completes after a feature is
|
|
1285
|
+
* enabled, after the video disconnects, or after a CV-feature toggle
|
|
1286
|
+
* clears state. A common pattern is
|
|
1287
|
+
* `viji.video.cv.analysedFrame ?? viji.video.currentFrame` to fall back
|
|
1288
|
+
* to the live feed during the brief startup window.
|
|
1289
|
+
*
|
|
1290
|
+
* Read-only: this `OffscreenCanvas` is owned by the engine. Do not
|
|
1291
|
+
* mutate it (no `getContext`-and-paint, no `transferToImageBitmap`).
|
|
1292
|
+
* Drawing it as a source (`ctx.drawImage`, `gl.texImage2D`,
|
|
1293
|
+
* `p5.image(...)`) is the only supported usage.
|
|
1294
|
+
*/
|
|
1295
|
+
analysedFrame: OffscreenCanvas | null;
|
|
1296
|
+
/**
|
|
1297
|
+
* Returns `analysedFrame` as raw RGBA `ImageData` for per-pixel CPU
|
|
1298
|
+
* analysis, or `null` when no CV result has landed yet (or the stream is
|
|
1299
|
+
* disconnected). Cached: re-extracted only when a new CV result arrives,
|
|
1300
|
+
* so multiple readers within a render share one allocation. Slow
|
|
1301
|
+
* compared to drawing `analysedFrame` directly — use only when you need
|
|
1302
|
+
* pixel values aligned with CV landmark positions (e.g. sampling skin
|
|
1303
|
+
* colour at a face landmark).
|
|
1304
|
+
*/
|
|
1305
|
+
getAnalysedFrameData: () => ImageData | null;
|
|
1240
1306
|
/** Detected faces (empty array when face detection is off or no faces are visible). */
|
|
1241
1307
|
faces: FaceData[];
|
|
1242
1308
|
/** Detected hands (up to 2; empty array when hand tracking is off or no hands are visible). */
|
|
@@ -1246,50 +1312,42 @@ declare global {
|
|
|
1246
1312
|
/** Body segmentation mask, or `null` when segmentation is off. */
|
|
1247
1313
|
segmentation: SegmentationData | null;
|
|
1248
1314
|
/**
|
|
1249
|
-
*
|
|
1250
|
-
*
|
|
1251
|
-
* `segmentation` field on the next available frame. Multiple features can be
|
|
1252
|
-
* active simultaneously, but each adds CPU/GPU and WebGL-context cost.
|
|
1315
|
+
* Toggle face detection (bounding box, center, confidence, id).
|
|
1316
|
+
* @returns Resolves once the underlying pipeline has finished switching.
|
|
1253
1317
|
*/
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
enableBodySegmentation(enabled: boolean): Promise<void>;
|
|
1288
|
-
/** Returns the list of CV features currently enabled on this stream. */
|
|
1289
|
-
getActiveFeatures(): CVFeature[];
|
|
1290
|
-
/** Returns `true` if the CV worker is actively processing frames. */
|
|
1291
|
-
isProcessing(): boolean;
|
|
1292
|
-
};
|
|
1318
|
+
enableFaceDetection(enabled: boolean): Promise<void>;
|
|
1319
|
+
/**
|
|
1320
|
+
* Toggle 468-point face mesh + head pose (`pitch`, `yaw`, `roll`). Implies
|
|
1321
|
+
* face detection.
|
|
1322
|
+
* @returns Resolves once the pipeline has finished switching.
|
|
1323
|
+
*/
|
|
1324
|
+
enableFaceMesh(enabled: boolean): Promise<void>;
|
|
1325
|
+
/**
|
|
1326
|
+
* Toggle 7 expressions + 52 ARKit blendshape coefficients on each face.
|
|
1327
|
+
* Implies face mesh.
|
|
1328
|
+
* @returns Resolves once the pipeline has finished switching.
|
|
1329
|
+
*/
|
|
1330
|
+
enableEmotionDetection(enabled: boolean): Promise<void>;
|
|
1331
|
+
/**
|
|
1332
|
+
* Toggle 21-point hand landmarks + ML-classified gesture confidences for up
|
|
1333
|
+
* to two hands.
|
|
1334
|
+
* @returns Resolves once the pipeline has finished switching.
|
|
1335
|
+
*/
|
|
1336
|
+
enableHandTracking(enabled: boolean): Promise<void>;
|
|
1337
|
+
/**
|
|
1338
|
+
* Toggle 33-point BlazePose body landmarks (face / torso / arms / legs).
|
|
1339
|
+
* @returns Resolves once the pipeline has finished switching.
|
|
1340
|
+
*/
|
|
1341
|
+
enablePoseDetection(enabled: boolean): Promise<void>;
|
|
1342
|
+
/**
|
|
1343
|
+
* Toggle per-pixel person/background segmentation mask.
|
|
1344
|
+
* @returns Resolves once the pipeline has finished switching.
|
|
1345
|
+
*/
|
|
1346
|
+
enableBodySegmentation(enabled: boolean): Promise<void>;
|
|
1347
|
+
/** Returns the list of CV features currently enabled on this stream. */
|
|
1348
|
+
getActiveFeatures(): CVFeature[];
|
|
1349
|
+
/** Returns `true` if the CV worker is actively processing frames. */
|
|
1350
|
+
isProcessing(): boolean;
|
|
1293
1351
|
}
|
|
1294
1352
|
|
|
1295
1353
|
/**
|
package/dist/artist-jsdoc.d.ts
CHANGED
|
@@ -265,7 +265,7 @@
|
|
|
265
265
|
*/
|
|
266
266
|
|
|
267
267
|
/**
|
|
268
|
-
* Real-time video API: drawable frame, dimensions, and computer-vision
|
|
268
|
+
* Real-time video API: drawable frame, dimensions, and the source-side properties of the connected stream. All computer-vision data and controls (faces, hands, pose, segmentation, the analysed frame, and feature enable/disable verbs) live on `viji.video.cv`. When `isConnected` is `false`, `currentFrame` is `null`, all dimensions are `0`, and every member of `cv` holds its empty default.
|
|
269
269
|
* @typedef {Object} VideoAPI
|
|
270
270
|
* @property {boolean} isConnected - `true` when a video stream is connected. When `false`, all other fields hold their default empty values.
|
|
271
271
|
* @property {OffscreenCanvas | ImageBitmap |null} currentFrame - Latest video frame, drawable directly with `ctx.drawImage()`. `null` when disconnected.
|
|
@@ -273,11 +273,7 @@
|
|
|
273
273
|
* @property {number} frameHeight - Source video frame height in pixels. `0` when disconnected.
|
|
274
274
|
* @property {number} frameRate - Source video frame rate in Hz (frames per second). `0` when disconnected.
|
|
275
275
|
* @property {() => ImageData |null} getFrameData - Returns the latest frame as raw RGBA `ImageData` for per-pixel CPU analysis, or `null` when disconnected. Slow compared to drawing `currentFrame` directly; use only when you need to read individual pixel values.
|
|
276
|
-
* @property {
|
|
277
|
-
* @property {HandData[]} hands - Detected hands (up to 2; empty array when hand tracking is off or no hands are visible).
|
|
278
|
-
* @property {PoseData |null} pose - Detected body pose, or `null` when pose detection is off or no pose is visible.
|
|
279
|
-
* @property {SegmentationData |null} segmentation - Body segmentation mask, or `null` when segmentation is off.
|
|
280
|
-
* @property {Object} cv - Computer-vision feature control. Each `enable*` method toggles a specific CV pipeline; results land in the corresponding `faces` / `hands` / `pose` / `segmentation` field on the next available frame. Multiple features can be active simultaneously, but each adds CPU/GPU and WebGL-context cost.
|
|
276
|
+
* @property {VideoCVAPI} cv - Computer-vision surface for this video stream. Holds both the data outputs (`faces`, `hands`, `pose`, `segmentation`, `analysedFrame`, `getAnalysedFrameData`) and the verbs that activate them (`enable*`/`disable*`/`getActiveFeatures`/`isProcessing`). Multiple features can be active simultaneously, but each adds CPU/GPU and WebGL-context cost — toggle only what you need. `analysedFrame` and the result fields refresh together once per host frame (atomic snapshot) — within a single `render()` call they are always paired.
|
|
281
277
|
*/
|
|
282
278
|
|
|
283
279
|
/**
|