@mediapipe/tasks-vision 0.10.7 → 0.10.8
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/package.json +1 -1
- package/vision.d.ts +74 -3
- package/vision_bundle.cjs +1 -1
- package/vision_bundle.cjs.map +1 -1
- package/vision_bundle.mjs +1 -1
- package/vision_bundle.mjs.map +1 -1
- package/wasm/vision_wasm_internal.js +2 -2
- package/wasm/vision_wasm_internal.wasm +0 -0
- package/wasm/vision_wasm_nosimd_internal.js +2 -2
- package/wasm/vision_wasm_nosimd_internal.wasm +0 -0
package/package.json
CHANGED
package/vision.d.ts
CHANGED
|
@@ -103,6 +103,12 @@ export declare interface Category {
|
|
|
103
103
|
displayName: string;
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
+
/**
|
|
107
|
+
* A category to color mapping that uses either a map or an array to assign
|
|
108
|
+
* category indexes to RGBA colors.
|
|
109
|
+
*/
|
|
110
|
+
export declare type CategoryToColorMap = Map<number, RGBAColor> | RGBAColor[];
|
|
111
|
+
|
|
106
112
|
/** Classification results for a given classifier head. */
|
|
107
113
|
export declare interface Classifications {
|
|
108
114
|
/**
|
|
@@ -171,6 +177,9 @@ declare interface Connection {
|
|
|
171
177
|
end: number;
|
|
172
178
|
}
|
|
173
179
|
|
|
180
|
+
/** A color map with 22 classes. Used in our demos. */
|
|
181
|
+
export declare const DEFAULT_CATEGORY_TO_COLOR_MAP: number[][];
|
|
182
|
+
|
|
174
183
|
/** Represents one detection by a detection task. */
|
|
175
184
|
export declare interface Detection {
|
|
176
185
|
/** A list of `Category` objects. */
|
|
@@ -218,9 +227,23 @@ export declare class DrawingUtils {
|
|
|
218
227
|
/**
|
|
219
228
|
* Creates a new DrawingUtils class.
|
|
220
229
|
*
|
|
221
|
-
* @param
|
|
230
|
+
* @param gpuContext The WebGL canvas rendering context to render into. If
|
|
231
|
+
* your Task is using a GPU delegate, the context must be obtained from
|
|
232
|
+
* its canvas (provided via `setOptions({ canvas: .. })`).
|
|
233
|
+
*/
|
|
234
|
+
constructor(gpuContext: WebGL2RenderingContext);
|
|
235
|
+
/**
|
|
236
|
+
* Creates a new DrawingUtils class.
|
|
237
|
+
*
|
|
238
|
+
* @param cpuContext The 2D canvas rendering context to render into. If
|
|
239
|
+
* you are rendering GPU data you must also provide `gpuContext` to allow
|
|
240
|
+
* for data conversion.
|
|
241
|
+
* @param gpuContext A WebGL canvas that is used for GPU rendering and for
|
|
242
|
+
* converting GPU to CPU data. If your Task is using a GPU delegate, the
|
|
243
|
+
* context must be obtained from its canvas (provided via
|
|
244
|
+
* `setOptions({ canvas: .. })`).
|
|
222
245
|
*/
|
|
223
|
-
constructor(
|
|
246
|
+
constructor(cpuContext: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D, gpuContext?: WebGL2RenderingContext);
|
|
224
247
|
/**
|
|
225
248
|
* Restricts a number between two endpoints (order doesn't matter).
|
|
226
249
|
*
|
|
@@ -247,6 +270,9 @@ export declare class DrawingUtils {
|
|
|
247
270
|
/**
|
|
248
271
|
* Draws circles onto the provided landmarks.
|
|
249
272
|
*
|
|
273
|
+
* This method can only be used when `DrawingUtils` is initialized with a
|
|
274
|
+
* `CanvasRenderingContext2D`.
|
|
275
|
+
*
|
|
250
276
|
* @export
|
|
251
277
|
* @param landmarks The landmarks to draw.
|
|
252
278
|
* @param style The style to visualize the landmarks.
|
|
@@ -255,6 +281,9 @@ export declare class DrawingUtils {
|
|
|
255
281
|
/**
|
|
256
282
|
* Draws lines between landmarks (given a connection graph).
|
|
257
283
|
*
|
|
284
|
+
* This method can only be used when `DrawingUtils` is initialized with a
|
|
285
|
+
* `CanvasRenderingContext2D`.
|
|
286
|
+
*
|
|
258
287
|
* @export
|
|
259
288
|
* @param landmarks The landmarks to draw.
|
|
260
289
|
* @param connections The connections array that contains the start and the
|
|
@@ -265,11 +294,42 @@ export declare class DrawingUtils {
|
|
|
265
294
|
/**
|
|
266
295
|
* Draws a bounding box.
|
|
267
296
|
*
|
|
297
|
+
* This method can only be used when `DrawingUtils` is initialized with a
|
|
298
|
+
* `CanvasRenderingContext2D`.
|
|
299
|
+
*
|
|
268
300
|
* @export
|
|
269
301
|
* @param boundingBox The bounding box to draw.
|
|
270
302
|
* @param style The style to visualize the boundin box.
|
|
271
303
|
*/
|
|
272
304
|
drawBoundingBox(boundingBox: BoundingBox, style?: DrawingOptions): void;
|
|
305
|
+
/**
|
|
306
|
+
* Draws a category mask using the provided category-to-color mapping.
|
|
307
|
+
*
|
|
308
|
+
* @export
|
|
309
|
+
* @param mask A category mask that was returned from a segmentation task.
|
|
310
|
+
* @param categoryToColorMap A map that maps category indices to RGBA
|
|
311
|
+
* values. You must specify a map entry for each category.
|
|
312
|
+
* @param background A color or image to use as the background. Defaults to
|
|
313
|
+
* black.
|
|
314
|
+
*/
|
|
315
|
+
drawCategoryMask(mask: MPMask, categoryToColorMap: Map<number, RGBAColor>, background?: RGBAColor | ImageSource): void;
|
|
316
|
+
/**
|
|
317
|
+
* Draws a category mask using the provided color array.
|
|
318
|
+
*
|
|
319
|
+
* @export
|
|
320
|
+
* @param mask A category mask that was returned from a segmentation task.
|
|
321
|
+
* @param categoryToColorMap An array that maps indices to RGBA values. The
|
|
322
|
+
* array's indices must correspond to the category indices of the model
|
|
323
|
+
* and an entry must be provided for each category.
|
|
324
|
+
* @param background A color or image to use as the background. Defaults to
|
|
325
|
+
* black.
|
|
326
|
+
*/
|
|
327
|
+
drawCategoryMask(mask: MPMask, categoryToColorMap: RGBAColor[], background?: RGBAColor | ImageSource): void;
|
|
328
|
+
/**
|
|
329
|
+
* Frees all WebGL resources held by this class.
|
|
330
|
+
* @export
|
|
331
|
+
*/
|
|
332
|
+
close(): void;
|
|
273
333
|
}
|
|
274
334
|
|
|
275
335
|
/**
|
|
@@ -922,7 +982,7 @@ export declare interface GestureRecognizerOptions extends VisionTaskOptions {
|
|
|
922
982
|
export declare interface GestureRecognizerResult {
|
|
923
983
|
/** Hand landmarks of detected hands. */
|
|
924
984
|
landmarks: NormalizedLandmark[][];
|
|
925
|
-
/** Hand landmarks in world
|
|
985
|
+
/** Hand landmarks in world coordinates of detected hands. */
|
|
926
986
|
worldLandmarks: Landmark[][];
|
|
927
987
|
/** Handedness of detected hands. */
|
|
928
988
|
handedness: Category[][];
|
|
@@ -2325,6 +2385,17 @@ export declare interface RegionOfInterest {
|
|
|
2325
2385
|
scribble?: NormalizedKeypoint[];
|
|
2326
2386
|
}
|
|
2327
2387
|
|
|
2388
|
+
/**
|
|
2389
|
+
* A four channel color with values for red, green, blue and alpha
|
|
2390
|
+
* respectively.
|
|
2391
|
+
*/
|
|
2392
|
+
export declare type RGBAColor = [
|
|
2393
|
+
number,
|
|
2394
|
+
number,
|
|
2395
|
+
number,
|
|
2396
|
+
number
|
|
2397
|
+
] | number[];
|
|
2398
|
+
|
|
2328
2399
|
/**
|
|
2329
2400
|
* The two running modes of a vision task.
|
|
2330
2401
|
* 1) The image mode for processing single image inputs.
|