|
1 | 1 | ---
|
2 | 2 | title: FaceLandmarker
|
3 |
| -nav: 0 |
4 | 3 | ---
|
5 | 4 |
|
6 | 5 | 
|
7 | 6 |
|
8 |
| -A @mediapipe/tasks-vision [](https://developers.google.com/mediapipe/api/solutions/js/tasks-vision.facelandmarker) provider, as well as a hook. |
| 7 | +A @mediapipe/tasks-vision [`FaceLandmarker`](https://developers.google.com/mediapipe/api/solutions/js/tasks-vision.facelandmarker) provider, as well as a `useFaceLandmarker` hook. |
9 | 8 |
|
10 |
| -It will instanciate a FaceLandmarker object with the following defaults: |
11 |
| - |
12 |
| -You can override defaults, like for example self-host tasks-vision's and model in you directory: |
13 |
| - |
14 |
| -Version: ImageMagick 7.1.1-36 Q16-HDRI aarch64 22352 https://imagemagick.org |
15 |
| -Copyright: (C) 1999 ImageMagick Studio LLC |
16 |
| -License: https://imagemagick.org/script/license.php |
17 |
| -Features: Cipher DPC HDRI Modules OpenMP(5.0) |
18 |
| -Delegates (built-in): bzlib fontconfig freetype gslib heic jng jp2 jpeg jxl lcms lqr ltdl lzma openexr png ps raw tiff webp xml zlib zstd |
19 |
| -Compiler: gcc (4.2) |
20 |
| -Usage: import [options ...] [ file ] |
| 9 | +```tsx |
| 10 | +<FaceLandmarker>{/* ... */}</FaceLandmarker> |
| 11 | +``` |
21 | 12 |
|
22 |
| -Image Settings: |
23 |
| --adjoin join images into a single multi-image file |
24 |
| --border include window border in the output image |
25 |
| --channel type apply option to select image channels |
26 |
| --colorspace type alternate image colorspace |
27 |
| --comment string annotate image with comment |
28 |
| --compress type type of pixel compression when writing the image |
29 |
| --define format:option |
30 |
| -define one or more image format options |
31 |
| --density geometry horizontal and vertical density of the image |
32 |
| --depth value image depth |
33 |
| --descend obtain image by descending window hierarchy |
34 |
| --display server X server to contact |
35 |
| --dispose method layer disposal method |
36 |
| --dither method apply error diffusion to image |
37 |
| --delay value display the next image after pausing |
38 |
| --encipher filename convert plain pixels to cipher pixels |
39 |
| --endian type endianness (MSB or LSB) of the image |
40 |
| --encoding type text encoding type |
41 |
| --filter type use this filter when resizing an image |
42 |
| --format "string" output formatted image characteristics |
43 |
| --frame include window manager frame |
44 |
| --gravity direction which direction to gravitate towards |
45 |
| --identify identify the format and characteristics of the image |
46 |
| --interlace type None, Line, Plane, or Partition |
47 |
| --interpolate method pixel color interpolation method |
48 |
| --label string assign a label to an image |
49 |
| --limit type value Area, Disk, Map, or Memory resource limit |
50 |
| --monitor monitor progress |
51 |
| --page geometry size and location of an image canvas |
52 |
| --pause seconds seconds delay between snapshots |
53 |
| --pointsize value font point size |
54 |
| --quality value JPEG/MIFF/PNG compression level |
55 |
| --quiet suppress all warning messages |
56 |
| --regard-warnings pay attention to warning messages |
57 |
| --repage geometry size and location of an image canvas |
58 |
| --respect-parentheses settings remain in effect until parenthesis boundary |
59 |
| --sampling-factor geometry |
60 |
| -horizontal and vertical sampling factor |
61 |
| --scene value image scene number |
62 |
| --screen select image from root window |
63 |
| --seed value seed a new sequence of pseudo-random numbers |
64 |
| --set property value set an image property |
65 |
| --silent operate silently, i.e. don't ring any bells |
66 |
| --snaps value number of screen snapshots |
67 |
| --support factor resize support: > 1.0 is blurry, < 1.0 is sharp |
68 |
| --synchronize synchronize image to storage device |
69 |
| --taint declare the image as modified |
70 |
| --transparent-color color |
71 |
| -transparent color |
72 |
| --treedepth value color tree depth |
73 |
| --verbose print detailed information about the image |
74 |
| --virtual-pixel method |
75 |
| -Constant, Edge, Mirror, or Tile |
76 |
| --window id select window with this id or name |
77 |
| -root selects whole screen |
78 |
| - |
79 |
| -Image Operators: |
80 |
| --annotate geometry text |
81 |
| -annotate the image with text |
82 |
| --colors value preferred number of colors in the image |
83 |
| --crop geometry preferred size and location of the cropped image |
84 |
| --encipher filename convert plain pixels to cipher pixels |
85 |
| --extent geometry set the image size |
86 |
| --geometry geometry preferred size or location of the image |
87 |
| --help print program options |
88 |
| --monochrome transform image to black and white |
89 |
| --negate replace every pixel with its complementary color |
90 |
| --quantize colorspace reduce colors in this colorspace |
91 |
| --resize geometry resize the image |
92 |
| --rotate degrees apply Paeth rotation to the image |
93 |
| --strip strip image of all profiles and comments |
94 |
| --thumbnail geometry create a thumbnail of the image |
95 |
| --transparent color make this color transparent within the image |
96 |
| --trim trim image edges |
97 |
| --type type image type |
98 |
| - |
99 |
| -Miscellaneous Options: |
100 |
| --debug events display copious debugging information |
101 |
| --help print program options |
102 |
| --list type print a list of supported option arguments |
103 |
| --log format format of debugging information |
104 |
| --version print version information |
| 13 | +It will instanciate a FaceLandmarker object with the following defaults: |
105 | 14 |
|
106 |
| -By default, 'file' is written in the MIFF image format. To |
107 |
| -specify a particular image format, precede the filename with an image |
108 |
| -format name and a colon (i.e. ps:image) or specify the image type as |
109 |
| -the filename suffix (i.e. image.ps). Specify 'file' as '-' for |
110 |
| -standard input or output. |
| 15 | +```tsx |
| 16 | +{ |
| 17 | + basePath: "https://cdn.jsdelivr.net/npm/@mediapipe/[email protected]/wasm", // x.y.z will value the @mediapipe/tasks-vision version, eg: 0.10.2 |
| 18 | + options: { |
| 19 | + baseOptions: { |
| 20 | + modelAssetPath: "https://storage.googleapis.com/mediapipe-models/face_landmarker/face_landmarker/float16/1/face_landmarker.task", |
| 21 | + delegate: "GPU", |
| 22 | + }, |
| 23 | + runningMode: "VIDEO", |
| 24 | + outputFaceBlendshapes: true, |
| 25 | + outputFacialTransformationMatrixes: true, |
| 26 | + } |
| 27 | +} |
| 28 | +``` |
| 29 | + |
| 30 | +You can override defaults, like for example self-host tasks-vision's `wasm/` and `face_landmarker.task` model in you `public/` directory: |
| 31 | + |
| 32 | +```sh |
| 33 | +$ ln -s ../node_modules/@mediapipe/tasks-vision/wasm/ public/tasks-vision-wasm |
| 34 | +$ curl https://storage.googleapis.com/mediapipe-models/face_landmarker/face_landmarker/float16/1/face_landmarker.task -o public/face_landmarker.task |
| 35 | +``` |
| 36 | + |
| 37 | +```tsx |
| 38 | +import { FaceLandmarkerDefaults } from '@react-three/drei' |
| 39 | + |
| 40 | +const visionBasePath = new URL("/tasks-vision-wasm", import.meta.url).toString() |
| 41 | +const modelAssetPath = new URL("/face_landmarker.task", import.meta.url).toString() |
| 42 | + |
| 43 | +const faceLandmarkerOptions = { ...FaceLandmarkerDefaults.options }; |
| 44 | +faceLandmarkerOptions.baseOptions.modelAssetPath = modelAssetPath; |
| 45 | + |
| 46 | +<FaceLandmarker basePath={visionBasePath} options={faceLandmarkerOptions}> |
| 47 | +``` |
0 commit comments