@mediapipe/tasks-vision 0.1.0-alpha-9 → 0.1.0-alpha-10
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
CHANGED
package/vision.d.ts
CHANGED
|
@@ -56,6 +56,12 @@ export declare interface BoundingBox {
|
|
|
56
56
|
height: number;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
/**
|
|
60
|
+
* A user-defined callback to take input data and map it to a custom output
|
|
61
|
+
* value.
|
|
62
|
+
*/
|
|
63
|
+
export declare type Callback<I, O> = (input: I) => O;
|
|
64
|
+
|
|
59
65
|
/**
|
|
60
66
|
* Copyright 2022 The MediaPipe Authors. All Rights Reserved.
|
|
61
67
|
*
|
|
@@ -153,23 +159,8 @@ declare interface ClassifierOptions {
|
|
|
153
159
|
categoryDenylist?: string[] | undefined;
|
|
154
160
|
}
|
|
155
161
|
|
|
156
|
-
/**
|
|
157
|
-
|
|
158
|
-
*
|
|
159
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
160
|
-
* you may not use this file except in compliance with the License.
|
|
161
|
-
* You may obtain a copy of the License at
|
|
162
|
-
*
|
|
163
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
164
|
-
*
|
|
165
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
166
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
167
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
168
|
-
* See the License for the specific language governing permissions and
|
|
169
|
-
* limitations under the License.
|
|
170
|
-
*/
|
|
171
|
-
/** A face landmark connection. */
|
|
172
|
-
export declare interface Connection {
|
|
162
|
+
/** A connection between two landmarks. */
|
|
163
|
+
declare interface Connection {
|
|
173
164
|
start: number;
|
|
174
165
|
end: number;
|
|
175
166
|
}
|
|
@@ -198,6 +189,77 @@ declare interface DetectionResult {
|
|
|
198
189
|
export { DetectionResult as FaceDetectorResult }
|
|
199
190
|
export { DetectionResult as ObjectDetectorResult }
|
|
200
191
|
|
|
192
|
+
/**
|
|
193
|
+
* Options for customizing the drawing routines
|
|
194
|
+
*/
|
|
195
|
+
export declare interface DrawingOptions {
|
|
196
|
+
/** The color that is used to draw the shape. Defaults to white. */
|
|
197
|
+
color?: string | CanvasGradient | CanvasPattern | Callback<LandmarkData, string | CanvasGradient | CanvasPattern>;
|
|
198
|
+
/**
|
|
199
|
+
* The color that is used to fill the shape. Defaults to `.color` (or black
|
|
200
|
+
* if color is not set).
|
|
201
|
+
*/
|
|
202
|
+
fillColor?: string | CanvasGradient | CanvasPattern | Callback<LandmarkData, string | CanvasGradient | CanvasPattern>;
|
|
203
|
+
/** The width of the line boundary of the shape. Defaults to 4. */
|
|
204
|
+
lineWidth?: number | Callback<LandmarkData, number>;
|
|
205
|
+
/** The radius of location marker. Defaults to 6. */
|
|
206
|
+
radius?: number | Callback<LandmarkData, number>;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/** Helper class to visualize the result of a MediaPipe Vision task. */
|
|
210
|
+
export declare class DrawingUtils {
|
|
211
|
+
/**
|
|
212
|
+
* Creates a new DrawingUtils class.
|
|
213
|
+
*
|
|
214
|
+
* @param ctx The canvas to render onto.
|
|
215
|
+
*/
|
|
216
|
+
constructor(ctx: CanvasRenderingContext2D);
|
|
217
|
+
/**
|
|
218
|
+
* Restricts a number between two endpoints (order doesn't matter).
|
|
219
|
+
*
|
|
220
|
+
* @param x The number to clamp.
|
|
221
|
+
* @param x0 The first boundary.
|
|
222
|
+
* @param x1 The second boundary.
|
|
223
|
+
* @return The clamped value.
|
|
224
|
+
*/
|
|
225
|
+
static clamp(x: number, x0: number, x1: number): number;
|
|
226
|
+
/**
|
|
227
|
+
* Linearly interpolates a value between two points, clamping that value to
|
|
228
|
+
* the endpoints.
|
|
229
|
+
*
|
|
230
|
+
* @param x The number to interpolate.
|
|
231
|
+
* @param x0 The x coordinate of the start value.
|
|
232
|
+
* @param x1 The x coordinate of the end value.
|
|
233
|
+
* @param y0 The y coordinate of the start value.
|
|
234
|
+
* @param y1 The y coordinate of the end value.
|
|
235
|
+
* @return The interpolated value.
|
|
236
|
+
*/
|
|
237
|
+
static lerp(x: number, x0: number, x1: number, y0: number, y1: number): number;
|
|
238
|
+
/**
|
|
239
|
+
* Draws circles onto the provided landmarks.
|
|
240
|
+
*
|
|
241
|
+
* @param landmarks The landmarks to draw.
|
|
242
|
+
* @param style The style to visualize the landmarks.
|
|
243
|
+
*/
|
|
244
|
+
drawLandmarks(landmarks?: NormalizedLandmark[], style?: DrawingOptions): void;
|
|
245
|
+
/**
|
|
246
|
+
* Draws lines between landmarks (given a connection graph).
|
|
247
|
+
*
|
|
248
|
+
* @param landmarks The landmarks to draw.
|
|
249
|
+
* @param connections The connections array that contains the start and the
|
|
250
|
+
* end indices for the connections to draw.
|
|
251
|
+
* @param style The style to visualize the landmarks.
|
|
252
|
+
*/
|
|
253
|
+
drawConnectors(landmarks?: NormalizedLandmark[], connections?: Connection[], style?: DrawingOptions): void;
|
|
254
|
+
/**
|
|
255
|
+
* Draws a bounding box.
|
|
256
|
+
*
|
|
257
|
+
* @param boundingBox The bounding box to draw.
|
|
258
|
+
* @param style The style to visualize the boundin box.
|
|
259
|
+
*/
|
|
260
|
+
drawBoundingBox(boundingBox: BoundingBox, style?: DrawingOptions): void;
|
|
261
|
+
}
|
|
262
|
+
|
|
201
263
|
/**
|
|
202
264
|
* Copyright 2022 The MediaPipe Authors. All Rights Reserved.
|
|
203
265
|
*
|
|
@@ -475,46 +537,16 @@ export declare interface FaceLandmarkerResult {
|
|
|
475
537
|
* connections.
|
|
476
538
|
*/
|
|
477
539
|
export declare class FaceLandmarksConnections {
|
|
478
|
-
static FACE_LANDMARKS_LIPS:
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
static
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
static
|
|
487
|
-
|
|
488
|
-
end: number;
|
|
489
|
-
}[];
|
|
490
|
-
static FACE_LANDMARKS_LEFT_IRIS: {
|
|
491
|
-
start: number;
|
|
492
|
-
end: number;
|
|
493
|
-
}[];
|
|
494
|
-
static FACE_LANDMARKS_RIGHT_EYE: {
|
|
495
|
-
start: number;
|
|
496
|
-
end: number;
|
|
497
|
-
}[];
|
|
498
|
-
static FACE_LANDMARKS_RIGHT_EYEBROW: {
|
|
499
|
-
start: number;
|
|
500
|
-
end: number;
|
|
501
|
-
}[];
|
|
502
|
-
static FACE_LANDMARKS_RIGHT_IRIS: {
|
|
503
|
-
start: number;
|
|
504
|
-
end: number;
|
|
505
|
-
}[];
|
|
506
|
-
static FACE_LANDMARKS_FACE_OVAL: {
|
|
507
|
-
start: number;
|
|
508
|
-
end: number;
|
|
509
|
-
}[];
|
|
510
|
-
static FACE_LANDMARKS_CONTOURS: {
|
|
511
|
-
start: number;
|
|
512
|
-
end: number;
|
|
513
|
-
}[];
|
|
514
|
-
static FACE_LANDMARKS_TESSELATION: {
|
|
515
|
-
start: number;
|
|
516
|
-
end: number;
|
|
517
|
-
}[];
|
|
540
|
+
static FACE_LANDMARKS_LIPS: Connection[];
|
|
541
|
+
static FACE_LANDMARKS_LEFT_EYE: Connection[];
|
|
542
|
+
static FACE_LANDMARKS_LEFT_EYEBROW: Connection[];
|
|
543
|
+
static FACE_LANDMARKS_LEFT_IRIS: Connection[];
|
|
544
|
+
static FACE_LANDMARKS_RIGHT_EYE: Connection[];
|
|
545
|
+
static FACE_LANDMARKS_RIGHT_EYEBROW: Connection[];
|
|
546
|
+
static FACE_LANDMARKS_RIGHT_IRIS: Connection[];
|
|
547
|
+
static FACE_LANDMARKS_FACE_OVAL: Connection[];
|
|
548
|
+
static FACE_LANDMARKS_CONTOURS: Connection[];
|
|
549
|
+
static FACE_LANDMARKS_TESSELATION: Connection[];
|
|
518
550
|
}
|
|
519
551
|
|
|
520
552
|
/** Performs face stylization on images. */
|
|
@@ -1416,6 +1448,13 @@ export declare interface Landmark {
|
|
|
1416
1448
|
z: number;
|
|
1417
1449
|
}
|
|
1418
1450
|
|
|
1451
|
+
/** Data that a user can use to specialize drawing options. */
|
|
1452
|
+
export declare interface LandmarkData {
|
|
1453
|
+
index?: number;
|
|
1454
|
+
from?: NormalizedLandmark;
|
|
1455
|
+
to?: NormalizedLandmark;
|
|
1456
|
+
}
|
|
1457
|
+
|
|
1419
1458
|
/**
|
|
1420
1459
|
* Copyright 2023 The MediaPipe Authors. All Rights Reserved.
|
|
1421
1460
|
*
|