@mediapipe/tasks-vision 0.1.0-alpha-6 → 0.1.0-alpha-7

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 (2) hide show
  1. package/package.json +1 -1
  2. package/vision.d.ts +141 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mediapipe/tasks-vision",
3
- "version": "0.1.0-alpha-6",
3
+ "version": "0.1.0-alpha-7",
4
4
  "description": "MediaPipe Vision Tasks",
5
5
  "main": "vision_bundle.js",
6
6
  "author": "mediapipe@google.com",
package/vision.d.ts CHANGED
@@ -224,6 +224,122 @@ export declare interface Embedding {
224
224
  headName: string;
225
225
  }
226
226
 
227
+ /**
228
+ * Performs face landmarks detection on images.
229
+ *
230
+ * This API expects a pre-trained face landmarker model asset bundle.
231
+ */
232
+ export declare class FaceLandmarker extends VisionTaskRunner {
233
+ /**
234
+ * Initializes the Wasm runtime and creates a new `FaceLandmarker` from the
235
+ * provided options.
236
+ * @param wasmFileset A configuration object that provides the location of the
237
+ * Wasm binary and its loader.
238
+ * @param faceLandmarkerOptions The options for the FaceLandmarker.
239
+ * Note that either a path to the model asset or a model buffer needs to
240
+ * be provided (via `baseOptions`).
241
+ */
242
+ static createFromOptions(wasmFileset: WasmFileset, faceLandmarkerOptions: FaceLandmarkerOptions): Promise<FaceLandmarker>;
243
+ /**
244
+ * Initializes the Wasm runtime and creates a new `FaceLandmarker` based on
245
+ * the provided model asset buffer.
246
+ * @param wasmFileset A configuration object that provides the location of the
247
+ * Wasm binary and its loader.
248
+ * @param modelAssetBuffer A binary representation of the model.
249
+ */
250
+ static createFromModelBuffer(wasmFileset: WasmFileset, modelAssetBuffer: Uint8Array): Promise<FaceLandmarker>;
251
+ /**
252
+ * Initializes the Wasm runtime and creates a new `FaceLandmarker` based on
253
+ * the path to the model asset.
254
+ * @param wasmFileset A configuration object that provides the location of the
255
+ * Wasm binary and its loader.
256
+ * @param modelAssetPath The path to the model asset.
257
+ */
258
+ static createFromModelPath(wasmFileset: WasmFileset, modelAssetPath: string): Promise<FaceLandmarker>;
259
+ private constructor();
260
+ /**
261
+ * Sets new options for this `FaceLandmarker`.
262
+ *
263
+ * Calling `setOptions()` with a subset of options only affects those options.
264
+ * You can reset an option back to its default value by explicitly setting it
265
+ * to `undefined`.
266
+ *
267
+ * @param options The options for the face landmarker.
268
+ */
269
+ setOptions(options: FaceLandmarkerOptions): Promise<void>;
270
+ /**
271
+ * Performs face landmarks detection on the provided single image and waits
272
+ * synchronously for the response. Only use this method when the
273
+ * FaceLandmarker is created with running mode `image`.
274
+ *
275
+ * @param image An image to process.
276
+ * @param imageProcessingOptions the `ImageProcessingOptions` specifying how
277
+ * to process the input image before running inference.
278
+ * @return The detected face landmarks.
279
+ */
280
+ detect(image: ImageSource, imageProcessingOptions?: ImageProcessingOptions): FaceLandmarkerResult;
281
+ /**
282
+ * Performs face landmarks detection on the provided video frame and waits
283
+ * synchronously for the response. Only use this method when the
284
+ * FaceLandmarker is created with running mode `video`.
285
+ *
286
+ * @param videoFrame A video frame to process.
287
+ * @param timestamp The timestamp of the current frame, in ms.
288
+ * @param imageProcessingOptions the `ImageProcessingOptions` specifying how
289
+ * to process the input image before running inference.
290
+ * @return The detected face landmarks.
291
+ */
292
+ detectForVideo(videoFrame: ImageSource, timestamp: number, imageProcessingOptions?: ImageProcessingOptions): FaceLandmarkerResult;
293
+ }
294
+
295
+ /** Options to configure the MediaPipe FaceLandmarker Task */
296
+ export declare interface FaceLandmarkerOptions extends VisionTaskOptions {
297
+ /**
298
+ * The maximum number of faces can be detected by the FaceLandmarker.
299
+ * Defaults to 1.
300
+ */
301
+ numFaces?: number | undefined;
302
+ /**
303
+ * The minimum confidence score for the face detection to be considered
304
+ * successful. Defaults to 0.5.
305
+ */
306
+ minFaceDetectionConfidence?: number | undefined;
307
+ /**
308
+ * The minimum confidence score of face presence score in the face landmark
309
+ * detection. Defaults to 0.5.
310
+ */
311
+ minFacePresenceConfidence?: number | undefined;
312
+ /**
313
+ * The minimum confidence score for the face tracking to be considered
314
+ * successful. Defaults to 0.5.
315
+ */
316
+ minTrackingConfidence?: number | undefined;
317
+ /**
318
+ * Whether FaceLandmarker outputs face blendshapes classification. Face
319
+ * blendshapes are used for rendering the 3D face model.
320
+ */
321
+ outputFaceBlendshapes?: boolean | undefined;
322
+ /**
323
+ * Whether FaceLandmarker outputs facial transformation_matrix. Facial
324
+ * transformation matrix is used to transform the face landmarks in canonical
325
+ * face to the detected face, so that users can apply face effects on the
326
+ * detected landmarks.
327
+ */
328
+ outputFacialTransformationMatrixes?: boolean | undefined;
329
+ }
330
+
331
+ /**
332
+ * Represents the face landmarks deection results generated by `FaceLandmarker`.
333
+ */
334
+ export declare interface FaceLandmarkerResult {
335
+ /** Detected face landmarks in normalized image coordinates. */
336
+ faceLandmarks: NormalizedLandmark[][];
337
+ /** Optional face blendshapes results. */
338
+ faceBlendshapes?: Classifications[];
339
+ /** Optional facial transformation matrix. */
340
+ facialTransformationMatrixes?: Matrix[];
341
+ }
342
+
227
343
  /** Performs face stylization on images. */
228
344
  export declare class FaceStylizer extends VisionTaskRunner {
229
345
  /**
@@ -1123,6 +1239,31 @@ export declare interface Landmark {
1123
1239
  z: number;
1124
1240
  }
1125
1241
 
1242
+ /**
1243
+ * Copyright 2023 The MediaPipe Authors. All Rights Reserved.
1244
+ *
1245
+ * Licensed under the Apache License, Version 2.0 (the "License");
1246
+ * you may not use this file except in compliance with the License.
1247
+ * You may obtain a copy of the License at
1248
+ *
1249
+ * http://www.apache.org/licenses/LICENSE-2.0
1250
+ *
1251
+ * Unless required by applicable law or agreed to in writing, software
1252
+ * distributed under the License is distributed on an "AS IS" BASIS,
1253
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1254
+ * See the License for the specific language governing permissions and
1255
+ * limitations under the License.
1256
+ */
1257
+ /** A two-dimenionsal matrix. */
1258
+ declare interface Matrix {
1259
+ /** The number of rows. */
1260
+ rows: number;
1261
+ /** The number of columns. */
1262
+ columns: number;
1263
+ /** The values as a flattened one-dimensional array. */
1264
+ data: number[];
1265
+ }
1266
+
1126
1267
  /**
1127
1268
  * Copyright 2023 The MediaPipe Authors. All Rights Reserved.
1128
1269
  *