Dlib FaceLandmark Detector 1.4.1
Enox Software
Loading...
Searching...
No Matches
DlibFaceLandmarkDetector.FaceLandmarkDetector Class Reference

Face landmark detector. More...

Classes

class  RectDetection
 Represents the detection result of an object, including its bounding rectangle, detection confidence, and weight index. More...
 

Public Member Functions

 FaceLandmarkDetector (string objectDetectorFilePath, string shapePredictorFilePath)
 Initializes a new instance of the FaceLandmarkDetector class.
 
 FaceLandmarkDetector (string shapePredictorFilePath)
 Initializes a new instance of the FaceLandmarkDetector class.
 
List< Rect > Detect ()
 Detects objects in the image.
 
List< Rect > Detect (double adjust_threshold)
 Detects objects in the image.
 
double[] DetectArray ()
 Detects objects in the image.
 
double[] DetectArray (double adjust_threshold)
 Detects objects in the image.
 
List< Vector2 > DetectLandmark (double left, double top, double width, double height)
 Detects the object landmarks within the specified region.
 
double double y[] DetectLandmark (in(double x, double y, double width, double height) rect)
 
List< Vector2 > DetectLandmark (Rect rect)
 Detects the object landmarks within the specified region defined by a rectangle.
 
double[] DetectLandmarkArray (double left, double top, double width, double height)
 Detects the object landmarks within the specified region defined by a rectangle.
 
double[] DetectLandmarkArray (in(double x, double y, double width, double height) rect)
 Detects the object landmarks within the specified region defined by a rectangle.
 
double[] DetectLandmarkArray (Rect rect)
 Detects the object landmarks within the specified region defined by a rectangle.
 
int DetectLandmarkOnly (double left, double top, double width, double height)
 Detects objects and returns the number of detected object landmarks.
 
int DetectLandmarkOnly (in(double x, double y, double width, double height) rect)
 Detects objects and returns the number of detected object landmarks within the specified region defined by a rectangle.
 
int DetectLandmarkOnly (Rect rect)
 Detects objects and returns the number of detected object landmarks within the specified region defined by a rectangle.
 
int DetectOnly ()
 Detects objects and returns the number of objects detected.
 
int DetectOnly (double adjust_threshold)
 Detects objects and returns the number of objects detected.
 
List< RectDetectionDetectRectDetection ()
 Detects objects in the image.
 
List< RectDetectionDetectRectDetection (double adjust_threshold)
 Detects objects in the image.
 
double double double double height[] DetectValueTuple ()
 
double double double double height[] DetectValueTuple (double adjust_threshold)
 
void DrawDetectLandmarkResult (IntPtr intPtr, int width, int height, int bytesPerPixel, bool flip, int r, int g, int b, int a)
 Draws the detected landmark result on the provided image buffer with optional vertical flipping.
 
void DrawDetectLandmarkResult (IntPtr intPtr, int width, int height, int bytesPerPixel, int r, int g, int b, int a)
 Draws the detected landmark result on the provided image buffer.
 
void DrawDetectLandmarkResult (Texture2D texture2D, int r, int g, int b, int a, bool updateMipmaps=false, bool makeNoLongerReadable=false)
 Draws the detected landmark result on the provided texture.
 
void DrawDetectLandmarkResult (Texture2D texture2D, int r, int g, int b, int a, Color32[] pixels32Buffer, byte[] rawTextureDataBuffer=null, bool updateMipmaps=false, bool makeNoLongerReadable=false)
 Draws the detected landmark result on the provided texture.
 
void DrawDetectLandmarkResult< T > (T[] array, int width, int height, int bytesPerPixel, bool flip, int r, int g, int b, int a)
 Draws the detected landmark result on the provided image buffer, with an option to flip the image vertically.
 
void DrawDetectLandmarkResult< T > (T[] array, int width, int height, int bytesPerPixel, int r, int g, int b, int a)
 Draws the detected landmark result on the provided image buffer.
 
void DrawDetectResult (IntPtr intPtr, int width, int height, int bytesPerPixel, bool flip, int r, int g, int b, int a, int thickness)
 Draws the detection result on a memory buffer with optional vertical flipping.
 
void DrawDetectResult (IntPtr intPtr, int width, int height, int bytesPerPixel, int r, int g, int b, int a, int thickness)
 Draws the detection result on a memory buffer.
 
void DrawDetectResult (Texture2D texture2D, int r, int g, int b, int a, int thickness, bool updateMipmaps=false, bool makeNoLongerReadable=false)
 Draws the detection result on the specified texture.
 
void DrawDetectResult (Texture2D texture2D, int r, int g, int b, int a, int thickness, Color32[] pixels32Buffer, byte[] rawTextureDataBuffer=null, bool updateMipmaps=false, bool makeNoLongerReadable=false)
 Draws the detection result on the specified texture.
 
void DrawDetectResult< T > (T[] array, int width, int height, int bytesPerPixel, bool flip, int r, int g, int b, int a, int thickness)
 Draws the detection result on an array representing the image data.
 
void DrawDetectResult< T > (T[] array, int width, int height, int bytesPerPixel, int r, int g, int b, int a, int thickness)
 Draws the detection result on an array representing the image data.
 
void GetDetectLandmarkResult (double[] result)
 Gets the result data of the object landmarks detected by the DetectLandmarkOnly() method, passing a data size of DetectLandmarkOnly() * 2 as an argument. This method can retrieve results without memory allocation.
 
void GetDetectLandmarkResult (Span< double > result)
 Gets the result data of the object landmarks detected by the DetectLandmarkOnly() method, passing a data size of DetectLandmarkOnly() * 2 as an argument. This method can retrieve results without memory allocation.
 
void GetDetectResult (double[] result)
 Gets the result data of the objects detected by the DetectOnly() method, passing a data size of DetectOnly() * 6 as an argument. This method can retrieve results without memory allocation.
 
void GetDetectResult (Span< double > result)
 Gets the result data of the objects detected by the DetectOnly() method, passing a data size of DetectOnly() * 6 as an argument. This method can retrieve results without memory allocation.
 
long GetShapePredictorNumFeatures ()
 Gets the number of features in the shape predictor.
 
long GetShapePredictorNumParts ()
 Gets the number of parts in the shape predictor.
 
bool IsAllPartsInRect ()
 Determines whether all of the object parts are contained within the object rectangle.
 
void SetImage (IntPtr intPtr, int width, int height, int bytesPerPixel)
 Sets the image from an IntPtr.
 
void SetImage (IntPtr intPtr, int width, int height, int bytesPerPixel, bool flip)
 Sets the image from an IntPtr.
 
void SetImage (Texture2D texture2D)
 Sets the image from a Texture2D.
 
void SetImage (WebCamTexture webCamTexture)
 Sets the image from a WebCamTexture.
 
void SetImage (WebCamTexture webCamTexture, Color32[] pixels32Buffer)
 Sets the image from a WebCamTexture.
 
void SetImage< T > (T[] array, int width, int height, int bytesPerPixel)
 Sets the image from a pixel data array.
 
void SetImage< T > (T[] array, int width, int height, int bytesPerPixel, bool flip)
 Sets the image from a pixel data array.
 
- Public Member Functions inherited from DlibFaceLandmarkDetector.DisposableObject
void Dispose ()
 
void ThrowIfDisposed ()
 

Public Attributes

double double double width
 
double x
 Detects objects in the image.
 
double double y
 

Protected Member Functions

override void Dispose (bool disposing)
 
- Protected Member Functions inherited from DlibFaceLandmarkDetector.DisposableDlibObject
 DisposableDlibObject ()
 
 DisposableDlibObject (bool isEnabledDispose)
 
 DisposableDlibObject (IntPtr ptr)
 
 DisposableDlibObject (IntPtr ptr, bool isEnabledDispose)
 
- Protected Member Functions inherited from DlibFaceLandmarkDetector.DisposableObject
 DisposableObject ()
 
 DisposableObject (bool isEnabledDispose)
 

Additional Inherited Members

- Static Public Member Functions inherited from DlibFaceLandmarkDetector.DisposableObject
static IntPtr ThrowIfNullIntPtr (IntPtr ptr)
 
- Package Attributes inherited from DlibFaceLandmarkDetector.DisposableDlibObject
- Properties inherited from DlibFaceLandmarkDetector.DisposableObject
bool IsDisposed [get, protected set]
 
bool IsEnabledDispose [get, set]
 

Detailed Description

Face landmark detector.

Constructor & Destructor Documentation

◆ FaceLandmarkDetector() [1/2]

DlibFaceLandmarkDetector.FaceLandmarkDetector.FaceLandmarkDetector ( string shapePredictorFilePath)

Initializes a new instance of the FaceLandmarkDetector class.

This instance uses the default frontal face detector.
ObjectDetector is initialized as follows:

frontal_face_detector face_detector;
face_detector = get_frontal_face_detector();

ShapePredictor is initialized as follows:

shape_predictor sp;
deserialize(shape_predictor_filename) >> sp;
Parameters
shapePredictorFilePathThe file path of the shape predictor.

◆ FaceLandmarkDetector() [2/2]

DlibFaceLandmarkDetector.FaceLandmarkDetector.FaceLandmarkDetector ( string objectDetectorFilePath,
string shapePredictorFilePath )

Initializes a new instance of the FaceLandmarkDetector class.

ObjectDetector is initialized with the following code:

if (object_detector_filename != null)
{
object_detector<scan_fhog_pyramid<pyramid_down<6>>> simple_detector;
deserialize(object_detector_filename) >> simple_detector;
}
else
{
frontal_face_detector face_detector;
face_detector = get_frontal_face_detector();
}

ShapePredictor is initialized with the following code:

shape_predictor sp;
deserialize(shape_predictor_filename) >> sp;
Parameters
objectDetectorFilePathThe file path of the object detector.
shapePredictorFilePathThe file path of the shape predictor.

Member Function Documentation

◆ Detect() [1/2]

List< Rect > DlibFaceLandmarkDetector.FaceLandmarkDetector.Detect ( )

Detects objects in the image.

Returns
A list of Rect representing the detected objects.

◆ Detect() [2/2]

List< Rect > DlibFaceLandmarkDetector.FaceLandmarkDetector.Detect ( double adjust_threshold)

Detects objects in the image.

Parameters
adjust_thresholdA parameter to adjust the detection threshold.
Returns
A list of Rect representing the detected objects.

◆ DetectArray() [1/2]

double[] DlibFaceLandmarkDetector.FaceLandmarkDetector.DetectArray ( )

Detects objects in the image.

Returns
An array of doubles representing detected object data. The array contains values in the following order:
  • left_0, top_0, width_0, height_0, detection_confidence_0, weight_index_0
  • left_1, top_1, width_1, height_1, detection_confidence_1, weight_index_1
  • ...

◆ DetectArray() [2/2]

double[] DlibFaceLandmarkDetector.FaceLandmarkDetector.DetectArray ( double adjust_threshold)

Detects objects in the image.

Parameters
adjust_thresholdA parameter to adjust the detection threshold.
Returns
An array of doubles representing detected object data. The array contains values in the following order:
  • left_0, top_0, width_0, height_0, detection_confidence_0, weight_index_0
  • left_1, top_1, width_1, height_1, detection_confidence_1, weight_index_1
  • ...

◆ DetectLandmark() [1/3]

List< Vector2 > DlibFaceLandmarkDetector.FaceLandmarkDetector.DetectLandmark ( double left,
double top,
double width,
double height )

Detects the object landmarks within the specified region.

Parameters
leftThe left coordinate of the region to search for landmarks.
topThe top coordinate of the region to search for landmarks.
widthThe width of the region to search for landmarks.
heightThe height of the region to search for landmarks.
Returns
A list of Vector2 representing the detected object landmarks.

◆ DetectLandmark() [2/3]

double double y[] DlibFaceLandmarkDetector.FaceLandmarkDetector.DetectLandmark ( in(double x, double y, double width, double height) rect)

◆ DetectLandmark() [3/3]

List< Vector2 > DlibFaceLandmarkDetector.FaceLandmarkDetector.DetectLandmark ( Rect rect)

Detects the object landmarks within the specified region defined by a rectangle.

Parameters
rectA rectangle defining the region to search for landmarks. The rectangle is defined by its left, top, width, and height.
Returns
A list of Vector2 representing the detected object landmarks.

◆ DetectLandmarkArray() [1/3]

double[] DlibFaceLandmarkDetector.FaceLandmarkDetector.DetectLandmarkArray ( double left,
double top,
double width,
double height )

Detects the object landmarks within the specified region defined by a rectangle.

Parameters
leftThe left coordinate of the rectangle.
topThe top coordinate of the rectangle.
widthThe width of the rectangle.
heightThe height of the rectangle.
Returns
An array of doubles representing the detected object landmark data. The array contains values in the following order:
  • x_0, y_0
  • x_1, y_1
  • ...

◆ DetectLandmarkArray() [2/3]

double[] DlibFaceLandmarkDetector.FaceLandmarkDetector.DetectLandmarkArray ( in(double x, double y, double width, double height) rect)

Detects the object landmarks within the specified region defined by a rectangle.

Parameters
rectA ValueTuple<Double, Double, Double, Double> representing a rectangle. The ValueTuple contains the following values:
  • x (left), y (top), width, height
Returns
An array of doubles representing the detected object landmark data. The array contains values in the following order:
  • x_0, y_0
  • x_1, y_1
  • ...
If no landmarks are detected, the method returns the default value (null).

◆ DetectLandmarkArray() [3/3]

double[] DlibFaceLandmarkDetector.FaceLandmarkDetector.DetectLandmarkArray ( Rect rect)

Detects the object landmarks within the specified region defined by a rectangle.

Parameters
rectThe rectangle defining the region in which to detect object landmarks.
Returns
An array of doubles representing the detected object landmark data. The array contains values in the following order:
  • x_0, y_0
  • x_1, y_1
  • ...

◆ DetectLandmarkOnly() [1/3]

int DlibFaceLandmarkDetector.FaceLandmarkDetector.DetectLandmarkOnly ( double left,
double top,
double width,
double height )

Detects objects and returns the number of detected object landmarks.

Parameters
leftThe left coordinate of the object region to detect landmarks.
topThe top coordinate of the object region to detect landmarks.
widthThe width of the object region to detect landmarks.
heightThe height of the object region to detect landmarks.
Returns
An integer representing the number of detected object landmarks.

◆ DetectLandmarkOnly() [2/3]

int DlibFaceLandmarkDetector.FaceLandmarkDetector.DetectLandmarkOnly ( in(double x, double y, double width, double height) rect)

Detects objects and returns the number of detected object landmarks within the specified region defined by a rectangle.

Parameters
rectA ValueTuple<Double, Double, Double, Double> representing a rectangle. The ValueTuple contains the following values:
  • x (left), y (top), width, height
Returns
An integer representing the number of object landmarks detected within the specified region.

◆ DetectLandmarkOnly() [3/3]

int DlibFaceLandmarkDetector.FaceLandmarkDetector.DetectLandmarkOnly ( Rect rect)

Detects objects and returns the number of detected object landmarks within the specified region defined by a rectangle.

Parameters
rectThe rectangle defining the region in which to detect object landmarks.
Returns
An integer representing the number of detected object landmarks.

◆ DetectOnly() [1/2]

int DlibFaceLandmarkDetector.FaceLandmarkDetector.DetectOnly ( )

Detects objects and returns the number of objects detected.

Returns
The number of objects detected.

◆ DetectOnly() [2/2]

int DlibFaceLandmarkDetector.FaceLandmarkDetector.DetectOnly ( double adjust_threshold)

Detects objects and returns the number of objects detected.

Parameters
adjust_thresholdA parameter to adjust the detection threshold.
Returns
The number of objects detected.

◆ DetectRectDetection() [1/2]

List< RectDetection > DlibFaceLandmarkDetector.FaceLandmarkDetector.DetectRectDetection ( )

Detects objects in the image.

Returns
A list of RectDetection representing the detected objects.

◆ DetectRectDetection() [2/2]

List< RectDetection > DlibFaceLandmarkDetector.FaceLandmarkDetector.DetectRectDetection ( double adjust_threshold)

Detects objects in the image.

Parameters
adjust_thresholdA parameter to adjust the detection threshold.
Returns
A list of RectDetection representing the detected objects.

◆ DetectValueTuple() [1/2]

double double double double height[] DlibFaceLandmarkDetector.FaceLandmarkDetector.DetectValueTuple ( )

◆ DetectValueTuple() [2/2]

double double double double height[] DlibFaceLandmarkDetector.FaceLandmarkDetector.DetectValueTuple ( double adjust_threshold)

◆ Dispose()

override void DlibFaceLandmarkDetector.FaceLandmarkDetector.Dispose ( bool disposing)
protectedvirtual

◆ DrawDetectLandmarkResult() [1/4]

void DlibFaceLandmarkDetector.FaceLandmarkDetector.DrawDetectLandmarkResult ( IntPtr intPtr,
int width,
int height,
int bytesPerPixel,
bool flip,
int r,
int g,
int b,
int a )

Draws the detected landmark result on the provided image buffer with optional vertical flipping.

Parameters
intPtrThe pointer to the memory buffer where the detected landmark result will be drawn.
widthThe width of the image (in pixels) where the landmarks will be drawn.
heightThe height of the image (in pixels) where the landmarks will be drawn.
bytesPerPixelThe number of bytes per pixel in the memory buffer. Valid values are 1 (grayscale), 3 (RGB), or 4 (RGBA).
flipA boolean flag indicating whether to flip the image vertically. Set to true to flip, or false to leave the image unflipped.
rThe red component (0-255) of the color to use for drawing the landmarks.
gThe green component (0-255) of the color to use for drawing the landmarks.
bThe blue component (0-255) of the color to use for drawing the landmarks.
aThe alpha (transparency) component (0-255) of the color to use for drawing the landmarks.

◆ DrawDetectLandmarkResult() [2/4]

void DlibFaceLandmarkDetector.FaceLandmarkDetector.DrawDetectLandmarkResult ( IntPtr intPtr,
int width,
int height,
int bytesPerPixel,
int r,
int g,
int b,
int a )

Draws the detected landmark result on the provided image buffer.

Parameters
intPtrThe pointer to the memory buffer where the detected landmark result will be drawn.
widthThe width of the image (in pixels) where the landmarks will be drawn.
heightThe height of the image (in pixels) where the landmarks will be drawn.
bytesPerPixelThe number of bytes per pixel in the memory buffer. Valid values are 1 (grayscale), 3 (RGB), or 4 (RGBA).
rThe red component (0-255) of the color to use for drawing the landmarks.
gThe green component (0-255) of the color to use for drawing the landmarks.
bThe blue component (0-255) of the color to use for drawing the landmarks.
aThe alpha (transparency) component (0-255) of the color to use for drawing the landmarks.

◆ DrawDetectLandmarkResult() [3/4]

void DlibFaceLandmarkDetector.FaceLandmarkDetector.DrawDetectLandmarkResult ( Texture2D texture2D,
int r,
int g,
int b,
int a,
bool updateMipmaps = false,
bool makeNoLongerReadable = false )

Draws the detected landmark result on the provided texture.

Parameters
texture2DThe Texture2D on where the detected landmark result will be drawn. Processing speed is fastest when the texture format is TextureFormat.RGBA32, TextureFormat.RGB24, or TextureFormat.Alpha8.
rThe red component (0-255) of the color to use for drawing the landmarks.
gThe green component (0-255) of the color to use for drawing the landmarks.
bThe blue component (0-255) of the color to use for drawing the landmarks.
aThe alpha (transparency) component (0-255) of the color to use for drawing the landmarks.
updateMipmapsIf set to true, mipmap levels of the texture will be recalculated.
makeNoLongerReadableIf set to true, the system memory copy of the texture will be released, making it no longer readable.

◆ DrawDetectLandmarkResult() [4/4]

void DlibFaceLandmarkDetector.FaceLandmarkDetector.DrawDetectLandmarkResult ( Texture2D texture2D,
int r,
int g,
int b,
int a,
Color32[] pixels32Buffer,
byte[] rawTextureDataBuffer = null,
bool updateMipmaps = false,
bool makeNoLongerReadable = false )

Draws the detected landmark result on the provided texture.

Parameters
texture2DThe Texture2D on where the detected landmark result will be drawn. Processing speed is fastest when the texture format is TextureFormat.RGBA32, TextureFormat.RGB24, or TextureFormat.Alpha8.
rThe red component (0-255) of the color to use for drawing the landmarks.
gThe green component (0-255) of the color to use for drawing the landmarks.
bThe blue component (0-255) of the color to use for drawing the landmarks.
aThe alpha (transparency) component (0-255) of the color to use for drawing the landmarks.
pixels32BufferAn optional array to receive pixel data in the form of Color32. You can pass in an existing array to avoid allocating new memory each frame. The array should be initialized to a length matching the width * height of the texture. WebCamTexture.GetPixels32
rawTextureDataBufferAn optional array to receive raw texture data in the form of bytes. You can pass in an existing array to avoid allocating new memory each frame. The array should be initialized to a length matching the raw data size of the texture. Texture2D.GetRawTextureData
updateMipmapsIf set to true, mipmap levels of the texture will be recalculated.
makeNoLongerReadableIf set to true, the system memory copy of the texture will be released, making it no longer readable.

◆ DrawDetectLandmarkResult< T >() [1/2]

void DlibFaceLandmarkDetector.FaceLandmarkDetector.DrawDetectLandmarkResult< T > ( T[] array,
int width,
int height,
int bytesPerPixel,
bool flip,
int r,
int g,
int b,
int a )

Draws the detected landmark result on the provided image buffer, with an option to flip the image vertically.

Parameters
arrayThe array representing the image data where the detected landmark result will be drawn. The array should contain pixel data in the format corresponding to bytesPerPixel .
widthThe width of the image (in pixels) where the landmarks will be drawn.
heightThe height of the image (in pixels) where the landmarks will be drawn.
bytesPerPixelThe number of bytes per pixel in the memory buffer. Valid values are 1 (grayscale), 3 (RGB), or 4 (RGBA).
flipA boolean flag indicating whether to flip the image vertically. Set to true to flip, or false to leave the image unflipped.
rThe red component (0-255) of the color to use for drawing the landmarks.
gThe green component (0-255) of the color to use for drawing the landmarks.
bThe blue component (0-255) of the color to use for drawing the landmarks.
aThe alpha (transparency) component (0-255) of the color to use for drawing the landmarks.
Type Constraints
T :unmanaged 

◆ DrawDetectLandmarkResult< T >() [2/2]

void DlibFaceLandmarkDetector.FaceLandmarkDetector.DrawDetectLandmarkResult< T > ( T[] array,
int width,
int height,
int bytesPerPixel,
int r,
int g,
int b,
int a )

Draws the detected landmark result on the provided image buffer.

Parameters
arrayThe array representing the image data where the detected landmark result will be drawn. The array should contain pixel data in the format corresponding to bytesPerPixel .
widthThe width of the image (in pixels) where the landmarks will be drawn.
heightThe height of the image (in pixels) where the landmarks will be drawn.
bytesPerPixelThe number of bytes per pixel in the memory buffer. Valid values are 1 (grayscale), 3 (RGB), or 4 (RGBA).
rThe red component (0-255) of the color to use for drawing the landmarks.
gThe green component (0-255) of the color to use for drawing the landmarks.
bThe blue component (0-255) of the color to use for drawing the landmarks.
aThe alpha (transparency) component (0-255) of the color to use for drawing the landmarks.
Type Constraints
T :unmanaged 

◆ DrawDetectResult() [1/4]

void DlibFaceLandmarkDetector.FaceLandmarkDetector.DrawDetectResult ( IntPtr intPtr,
int width,
int height,
int bytesPerPixel,
bool flip,
int r,
int g,
int b,
int a,
int thickness )

Draws the detection result on a memory buffer with optional vertical flipping.

Parameters
intPtrThe pointer to the memory buffer where the detection result will be drawn.
widthThe width of the image (in pixels) where the detection result will be drawn.
heightThe height of the image (in pixels) where the detection result will be drawn.
bytesPerPixelThe number of bytes per pixel in the memory buffer. Valid values are 1 (grayscale), 3 (RGB), or 4 (RGBA).
flipA boolean flag indicating whether to flip the image vertically. Set to true to flip, or false to leave the image unflipped.
rThe red component of the color to be used for drawing (0-255).
gThe green component of the color to be used for drawing (0-255).
bThe blue component of the color to be used for drawing (0-255).
aThe alpha (transparency) component of the color to be used for drawing (0-255).
thicknessThe thickness of the lines used to draw the detection results.

◆ DrawDetectResult() [2/4]

void DlibFaceLandmarkDetector.FaceLandmarkDetector.DrawDetectResult ( IntPtr intPtr,
int width,
int height,
int bytesPerPixel,
int r,
int g,
int b,
int a,
int thickness )

Draws the detection result on a memory buffer.

Parameters
intPtrThe pointer to the memory buffer where the detection result will be drawn.
widthThe width of the image (in pixels) where the detection result will be drawn.
heightThe height of the image (in pixels) where the detection result will be drawn.
bytesPerPixelThe number of bytes per pixel in the memory buffer. Valid values are 1 (grayscale), 3 (RGB), or 4 (RGBA).
rThe red component of the color to be used for drawing (0-255).
gThe green component of the color to be used for drawing (0-255).
bThe blue component of the color to be used for drawing (0-255).
aThe alpha (transparency) component of the color to be used for drawing (0-255).
thicknessThe thickness of the lines used to draw the detection results.

◆ DrawDetectResult() [3/4]

void DlibFaceLandmarkDetector.FaceLandmarkDetector.DrawDetectResult ( Texture2D texture2D,
int r,
int g,
int b,
int a,
int thickness,
bool updateMipmaps = false,
bool makeNoLongerReadable = false )

Draws the detection result on the specified texture.

Parameters
texture2DThe Texture2D on which the detection result will be drawn. Processing speed is fastest when the texture format is TextureFormat.RGBA32, TextureFormat.RGB24, or TextureFormat.Alpha8.
rThe red component of the color to be used for drawing (0-255).
gThe green component of the color to be used for drawing (0-255).
bThe blue component of the color to be used for drawing (0-255).
aThe alpha (transparency) component of the color to be used for drawing (0-255).
thicknessThe thickness of the lines used to draw the detection results.
updateMipmapsIf set to true, mipmap levels of the texture will be recalculated.
makeNoLongerReadableIf set to true, the system memory copy of the texture will be released, making it no longer readable.

◆ DrawDetectResult() [4/4]

void DlibFaceLandmarkDetector.FaceLandmarkDetector.DrawDetectResult ( Texture2D texture2D,
int r,
int g,
int b,
int a,
int thickness,
Color32[] pixels32Buffer,
byte[] rawTextureDataBuffer = null,
bool updateMipmaps = false,
bool makeNoLongerReadable = false )

Draws the detection result on the specified texture.

Parameters
texture2DThe Texture2D on which the detection result will be drawn. Processing speed is fastest when the texture format is TextureFormat.RGBA32, TextureFormat.RGB24, or TextureFormat.Alpha8.
rThe red component of the color to be used for drawing (0-255).
gThe green component of the color to be used for drawing (0-255).
bThe blue component of the color to be used for drawing (0-255).
aThe alpha (transparency) component of the color to be used for drawing (0-255).
thicknessThe thickness of the lines used to draw the detection results.
pixels32BufferAn optional array to receive the Color32 pixel data. You can pass in an array to avoid allocating new memory each frame. The array must be initialized to a length matching the width * height of the texture. WebCamTexture.GetPixels32.
rawTextureDataBufferAn optional array to receive raw texture data. You can pass in an array to avoid allocating new memory each frame. The array must be initialized to a length matching the raw data size of the texture. Texture2D.GetRawTextureData.
updateMipmapsIf set to true, mipmap levels of the texture will be recalculated.
makeNoLongerReadableIf set to true, the system memory copy of the texture will be released, making it no longer readable.

◆ DrawDetectResult< T >() [1/2]

void DlibFaceLandmarkDetector.FaceLandmarkDetector.DrawDetectResult< T > ( T[] array,
int width,
int height,
int bytesPerPixel,
bool flip,
int r,
int g,
int b,
int a,
int thickness )

Draws the detection result on an array representing the image data.

Parameters
arrayThe array representing the image data where the detection result will be drawn. The array should contain pixel data in the format corresponding to bytesPerPixel .
widthThe width of the image (in pixels) where the detection result will be drawn.
heightThe height of the image (in pixels) where the detection result will be drawn.
bytesPerPixelThe number of bytes per pixel in the memory buffer. Valid values are 1 (grayscale), 3 (RGB), or 4 (RGBA).
flipA boolean flag indicating whether to flip the image vertically. Set to true to flip, or false to leave the image unflipped.
rThe red component of the color to be used for drawing (0-255).
gThe green component of the color to be used for drawing (0-255).
bThe blue component of the color to be used for drawing (0-255).
aThe alpha (transparency) component of the color to be used for drawing (0-255).
thicknessThe thickness of the lines used to draw the detection results.
Type Constraints
T :unmanaged 

◆ DrawDetectResult< T >() [2/2]

void DlibFaceLandmarkDetector.FaceLandmarkDetector.DrawDetectResult< T > ( T[] array,
int width,
int height,
int bytesPerPixel,
int r,
int g,
int b,
int a,
int thickness )

Draws the detection result on an array representing the image data.

Parameters
arrayThe array representing the image data where the detection result will be drawn. The array should contain pixel data in the format corresponding to bytesPerPixel .
widthThe width of the image (in pixels) where the detection result will be drawn.
heightThe height of the image (in pixels) where the detection result will be drawn.
bytesPerPixelThe number of bytes per pixel in the memory buffer. Valid values are 1 (grayscale), 3 (RGB), or 4 (RGBA).
rThe red component of the color to be used for drawing (0-255).
gThe green component of the color to be used for drawing (0-255).
bThe blue component of the color to be used for drawing (0-255).
aThe alpha (transparency) component of the color to be used for drawing (0-255).
thicknessThe thickness of the lines used to draw the detection results.
Type Constraints
T :unmanaged 

◆ GetDetectLandmarkResult() [1/2]

void DlibFaceLandmarkDetector.FaceLandmarkDetector.GetDetectLandmarkResult ( double[] result)

Gets the result data of the object landmarks detected by the DetectLandmarkOnly() method, passing a data size of DetectLandmarkOnly() * 2 as an argument. This method can retrieve results without memory allocation.

Parameters
resultAn array of doubles representing detected object landmark data. The array contains values in the following order:
  • x_0, y_0
  • x_1, y_1
  • ...
The array is passed by reference to receive the landmark result data without allocating new memory each time.

◆ GetDetectLandmarkResult() [2/2]

void DlibFaceLandmarkDetector.FaceLandmarkDetector.GetDetectLandmarkResult ( Span< double > result)

Gets the result data of the object landmarks detected by the DetectLandmarkOnly() method, passing a data size of DetectLandmarkOnly() * 2 as an argument. This method can retrieve results without memory allocation.

Parameters
resultA span of doubles representing detected object landmark data. The span contains values in the following order:
  • x_0, y_0
  • x_1, y_1
  • ...
The span is passed by reference to receive the landmark result data without allocating new memory each time.

◆ GetDetectResult() [1/2]

void DlibFaceLandmarkDetector.FaceLandmarkDetector.GetDetectResult ( double[] result)

Gets the result data of the objects detected by the DetectOnly() method, passing a data size of DetectOnly() * 6 as an argument. This method can retrieve results without memory allocation.

Parameters
resultAn array of doubles representing detected object data. The array contains values in the following order:
  • left_0, top_0, width_0, height_0, detection_confidence_0, weight_index_0
  • left_1, top_1, width_1, height_1, detection_confidence_1, weight_index_1
  • ...
The array is passed by reference to receive the detection result data without allocating new memory each time.

◆ GetDetectResult() [2/2]

void DlibFaceLandmarkDetector.FaceLandmarkDetector.GetDetectResult ( Span< double > result)

Gets the result data of the objects detected by the DetectOnly() method, passing a data size of DetectOnly() * 6 as an argument. This method can retrieve results without memory allocation.

Parameters
resultA span of doubles representing detected object data. The span contains values in the following order:
  • left_0, top_0, width_0, height_0, detection_confidence_0, weight_index_0
  • left_1, top_1, width_1, height_1, detection_confidence_1, weight_index_1
  • ...
The span is passed by reference to receive the detection result data without allocating new memory each time.

◆ GetShapePredictorNumFeatures()

long DlibFaceLandmarkDetector.FaceLandmarkDetector.GetShapePredictorNumFeatures ( )

Gets the number of features in the shape predictor.

Returns
A long representing the number of features in the shape predictor.

◆ GetShapePredictorNumParts()

long DlibFaceLandmarkDetector.FaceLandmarkDetector.GetShapePredictorNumParts ( )

Gets the number of parts in the shape predictor.

Returns
A long representing the number of parts in the shape predictor.

◆ IsAllPartsInRect()

bool DlibFaceLandmarkDetector.FaceLandmarkDetector.IsAllPartsInRect ( )

Determines whether all of the object parts are contained within the object rectangle.

Returns
A boolean value indicating whether all of the object parts are inside the rectangle. true if all points are contained within the rectangle, otherwise false.

◆ SetImage() [1/5]

void DlibFaceLandmarkDetector.FaceLandmarkDetector.SetImage ( IntPtr intPtr,
int width,
int height,
int bytesPerPixel )

Sets the image from an IntPtr.

Parameters
intPtrThe IntPtr pointing to the image data.
widthThe width of the image.
heightThe height of the image.
bytesPerPixelThe number of bytes per pixel (1, 3, or 4).

◆ SetImage() [2/5]

void DlibFaceLandmarkDetector.FaceLandmarkDetector.SetImage ( IntPtr intPtr,
int width,
int height,
int bytesPerPixel,
bool flip )

Sets the image from an IntPtr.

Parameters
intPtrThe IntPtr pointing to the image data.
widthThe width of the image.
heightThe height of the image.
bytesPerPixelThe number of bytes per pixel (1, 3, or 4).
flipIf true, the image will be flipped vertically.

◆ SetImage() [3/5]

void DlibFaceLandmarkDetector.FaceLandmarkDetector.SetImage ( Texture2D texture2D)

Sets the image from a Texture2D.

Parameters
texture2DProcessing speed is fastest when the TextureFormat is RGBA32, RGB24, or Alpha8.

◆ SetImage() [4/5]

void DlibFaceLandmarkDetector.FaceLandmarkDetector.SetImage ( WebCamTexture webCamTexture)

Sets the image from a WebCamTexture.

Parameters
webCamTextureThe WebCamTexture to set as the image.

◆ SetImage() [5/5]

void DlibFaceLandmarkDetector.FaceLandmarkDetector.SetImage ( WebCamTexture webCamTexture,
Color32[] pixels32Buffer )

Sets the image from a WebCamTexture.

Parameters
webCamTextureThe WebCamTexture to set as the image.
pixels32BufferThe optional array to receive pixel data. You can pass in an array of Color32 values to avoid allocating new memory each frame. The array should have a length matching the width * height of the texture. WebCamTexture.GetPixels32

◆ SetImage< T >() [1/2]

void DlibFaceLandmarkDetector.FaceLandmarkDetector.SetImage< T > ( T[] array,
int width,
int height,
int bytesPerPixel )

Sets the image from a pixel data array.

Parameters
arrayThe array containing pixel data.
widthThe width of the image.
heightThe height of the image.
bytesPerPixelThe number of bytes per pixel (1, 3, or 4).
Type Constraints
T :unmanaged 

◆ SetImage< T >() [2/2]

void DlibFaceLandmarkDetector.FaceLandmarkDetector.SetImage< T > ( T[] array,
int width,
int height,
int bytesPerPixel,
bool flip )

Sets the image from a pixel data array.

Parameters
arrayThe array containing pixel data.
widthThe width of the image.
heightThe height of the image.
bytesPerPixelThe number of bytes per pixel (1, 3, or 4).
flipIf true, the image will be flipped vertically.
Type Constraints
T :unmanaged 

Member Data Documentation

◆ width

double double double DlibFaceLandmarkDetector.FaceLandmarkDetector.width

◆ x

double DlibFaceLandmarkDetector.FaceLandmarkDetector.x

Detects objects in the image.

Detects the object landmarks within the specified region defined by a rectangle.

Returns
An array of ValueTuple<Double, Double, Double, Double> representing detected object data. Each ValueTuple contains values in the following order:
  • x_0 (left), y_0 (top), width_0, height_0
  • x_1 (left), y_1 (top), width_1, height_1
  • ...
Parameters
adjust_thresholdA parameter to adjust the detection threshold.
Returns
An array of ValueTuple<Double, Double, Double, Double> representing detected object data. Each ValueTuple contains values in the following order:
  • x_0 (left), y_0 (top), width_0, height_0
  • x_1 (left), y_1 (top), width_1, height_1
  • ...
Parameters
rectA ValueTuple<Double, Double, Double, Double> representing a rectangle. The ValueTuple contains the following values:
  • x (left), y (top), width, height
Returns
An array of ValueTuple<Double, Double> representing the detected object landmarks. Each ValueTuple contains the x and y coordinates of a detected landmark. If no landmarks are detected, the method returns the default value (null).

◆ y

double double DlibFaceLandmarkDetector.FaceLandmarkDetector.y

The documentation for this class was generated from the following file: