FaceMeshDetection
Stay organized with collections
Save and categorize content based on your preferences.
Entry point to get a FaceMeshDetector
for finding FaceMesh
s in a
supplied image.
A FaceMeshDetector
is created via
getClient(FaceMeshDetectorOptions)
or getClient()
if you wish to use the default options. For example, the code below creates a FaceMeshDetector
with default options.
FaceMeshDetector faceMeshDetector = FaceMeshDetection.getClient();
To perform face mesh detection in an image, you first need to create an instance of
InputImage
from a
Bitmap
,
ByteBuffer
,
Image
etc.
See
InputImage
documentation for more details. For example, the code below creates an
InputImage
from a
Bitmap
.
InputImage image = InputImage.fromBitmap(bitmap, rotationDegrees);
Then the code below can detect face mesh in the supplied
InputImage
.
Task<List<FaceMesh>> task = faceMeshDetector.process(image);
task.addOnSuccessListener(...).addOnFailureListener(...);
Inherited Method Summary
From class java.lang.Object
Object
|
clone()
|
boolean |
|
void |
finalize()
|
final Class<?>
|
getClass()
|
int |
hashCode()
|
final void |
notify()
|
final void |
notifyAll()
|
String
|
toString()
|
final void |
wait(long arg0, int arg1)
|
final void |
wait(long arg0)
|
final void |
wait()
|
Public Methods
Parameters
options |
the options for the face mesh detector |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-31 UTC."],[[["\u003cp\u003e\u003ccode\u003eFaceMeshDetection\u003c/code\u003e is the entry point for finding face meshes in images using ML Kit.\u003c/p\u003e\n"],["\u003cp\u003eYou can get a \u003ccode\u003eFaceMeshDetector\u003c/code\u003e instance using \u003ccode\u003egetClient()\u003c/code\u003e with default or custom options.\u003c/p\u003e\n"],["\u003cp\u003eFace mesh detection is performed by processing an \u003ccode\u003eInputImage\u003c/code\u003e created from a Bitmap, ByteBuffer, or Image.\u003c/p\u003e\n"],["\u003cp\u003eTo release resources, call \u003ccode\u003eFaceMeshDetector.close()\u003c/code\u003e when the detector is no longer needed.\u003c/p\u003e\n"]]],["`FaceMeshDetection` is used to obtain a `FaceMeshDetector` for finding `FaceMesh` instances in an image. You can get a `FaceMeshDetector` instance with default options via `getClient()` or customized options with `getClient(FaceMeshDetectorOptions)`. To detect face meshes, create an `InputImage` from various sources (e.g., Bitmap) and use `faceMeshDetector.process(image)`. `FaceMeshDetector.close()` releases resources.\n"],null,["public class **FaceMeshDetection** extends [Object](//developer.android.com/reference/java/lang/Object.html) \nEntry point to get a [FaceMeshDetector](/android/reference/com/google/mlkit/vision/facemesh/FaceMeshDetector)\nfor finding [FaceMesh](/android/reference/com/google/mlkit/vision/facemesh/FaceMesh)s in a\nsupplied image.\n\nA [FaceMeshDetector](/android/reference/com/google/mlkit/vision/facemesh/FaceMeshDetector)\nis created via [getClient(FaceMeshDetectorOptions)](/android/reference/com/google/mlkit/vision/facemesh/FaceMeshDetection#getClient(com.google.mlkit.vision.facemesh.FaceMeshDetectorOptions)) or [getClient()](/android/reference/com/google/mlkit/vision/facemesh/FaceMeshDetection#getClient())\nif you wish to use the default options. For example, the code below creates a [FaceMeshDetector](/android/reference/com/google/mlkit/vision/facemesh/FaceMeshDetector)\nwith default options. \n\n FaceMeshDetector faceMeshDetector = FaceMeshDetection.getClient();\n \nTo perform face mesh detection in an image, you first need to create an instance of [InputImage](/android/reference/com/google/mlkit/vision/common/InputImage) from a [Bitmap](//developer.android.com/reference/android/graphics/Bitmap.html), [ByteBuffer](//developer.android.com/reference/java/nio/ByteBuffer.html), [Image](//developer.android.com/reference/android/media/Image.html) etc. See [InputImage](/android/reference/com/google/mlkit/vision/common/InputImage) documentation for more details. For example, the code below creates an [InputImage](/android/reference/com/google/mlkit/vision/common/InputImage) from a [Bitmap](//developer.android.com/reference/android/graphics/Bitmap.html). \n\n InputImage image = InputImage.fromBitmap(bitmap, rotationDegrees);\n \nThen the code below can detect face mesh in the supplied [InputImage](/android/reference/com/google/mlkit/vision/common/InputImage). \n\n Task\u003cList\u003cFaceMesh\u003e\u003e task = faceMeshDetector.process(image);\n task.addOnSuccessListener(...).addOnFailureListener(...);\n \nPublic Method Summary\n\n|-------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| static [FaceMeshDetector](/android/reference/com/google/mlkit/vision/facemesh/FaceMeshDetector) | [getClient](/android/reference/com/google/mlkit/vision/facemesh/FaceMeshDetection#getClient())() Gets an instance of [FaceMeshDetector](/android/reference/com/google/mlkit/vision/facemesh/FaceMeshDetector) that detects face mesh in a supplied image with a default [FaceMeshDetectorOptions](/android/reference/com/google/mlkit/vision/facemesh/FaceMeshDetectorOptions). |\n| static [FaceMeshDetector](/android/reference/com/google/mlkit/vision/facemesh/FaceMeshDetector) | [getClient](/android/reference/com/google/mlkit/vision/facemesh/FaceMeshDetection#getClient(com.google.mlkit.vision.facemesh.FaceMeshDetectorOptions))([FaceMeshDetectorOptions](/android/reference/com/google/mlkit/vision/facemesh/FaceMeshDetectorOptions) options) Gets a new instance of [FaceMeshDetector](/android/reference/com/google/mlkit/vision/facemesh/FaceMeshDetector) that detects face mesh in a supplied image. |\n\nInherited Method Summary \nFrom class java.lang.Object \n\n|----------------------------------------------------------------------------|--------------------------------------------------------------------------------|\n| [Object](//developer.android.com/reference/java/lang/Object.html) | clone() |\n| boolean | equals([Object](//developer.android.com/reference/java/lang/Object.html) arg0) |\n| void | finalize() |\n| final [Class](//developer.android.com/reference/java/lang/Class.html)\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| [String](//developer.android.com/reference/java/lang/String.html) | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nPublic Methods \n\npublic static [FaceMeshDetector](/android/reference/com/google/mlkit/vision/facemesh/FaceMeshDetector)\n**getClient** () \nGets an instance of [FaceMeshDetector](/android/reference/com/google/mlkit/vision/facemesh/FaceMeshDetector)\nthat detects face mesh in a supplied image with a default [FaceMeshDetectorOptions](/android/reference/com/google/mlkit/vision/facemesh/FaceMeshDetectorOptions).\n\nTo release the resources associated with a [FaceMeshDetector](/android/reference/com/google/mlkit/vision/facemesh/FaceMeshDetector),\nyou need to ensure that [FaceMeshDetector.close()](/android/reference/com/google/mlkit/vision/facemesh/FaceMeshDetector#close())\nis called on the resulting [FaceMeshDetector](/android/reference/com/google/mlkit/vision/facemesh/FaceMeshDetector)\nobject once it will no longer be used. \n\npublic static [FaceMeshDetector](/android/reference/com/google/mlkit/vision/facemesh/FaceMeshDetector)\n**getClient** ([FaceMeshDetectorOptions](/android/reference/com/google/mlkit/vision/facemesh/FaceMeshDetectorOptions) options) \nGets a new instance of [FaceMeshDetector](/android/reference/com/google/mlkit/vision/facemesh/FaceMeshDetector)\nthat detects face mesh in a supplied image.\n\nTo release the resources associated with a [FaceMeshDetector](/android/reference/com/google/mlkit/vision/facemesh/FaceMeshDetector),\nyou need to ensure that [FaceMeshDetector.close()](/android/reference/com/google/mlkit/vision/facemesh/FaceMeshDetector#close())\nis called on the resulting [FaceMeshDetector](/android/reference/com/google/mlkit/vision/facemesh/FaceMeshDetector)\nobject once it will no longer be used. \n\nParameters\n\n| options | the options for the face mesh detector |\n|---------|----------------------------------------|"]]