Dlib FaceLandmark Detector  1.3.8
Enox Software
Classes | Public Member Functions | Protected Member Functions | List of all members
DlibFaceLandmarkDetector.FaceLandmarkDetector Class Reference

Face landmark detector. More...

Inheritance diagram for DlibFaceLandmarkDetector.FaceLandmarkDetector:
DlibFaceLandmarkDetector.DisposableDlibObject DlibFaceLandmarkDetector.DisposableObject

Classes

class  RectDetection
 

Public Member Functions

 FaceLandmarkDetector (string shapePredictorFilePath)
 
 FaceLandmarkDetector (string objectDetectorFilePath, string shapePredictorFilePath)
 
void SetImage (Texture2D texture2D)
 
void SetImage (WebCamTexture webCamTexture)
 
void SetImage (WebCamTexture webCamTexture, Color32[] pixels32Buffer)
 
void SetImage (IntPtr intPtr, int width, int height, int bytesPerPixel)
 
void SetImage (IntPtr intPtr, int width, int height, int bytesPerPixel, bool flip)
 
void SetImage< T > (T[] array, int width, int height, int bytesPerPixel)
 
void SetImage< T > (T[] array, int width, int height, int bytesPerPixel, bool flip)
 
List< Rect > Detect ()
 
List< Rect > Detect (double adjust_threshold)
 
List< RectDetectionDetectRectDetection ()
 
List< RectDetectionDetectRectDetection (double adjust_threshold)
 
double [] DetectArray ()
 
double [] DetectArray (double adjust_threshold)
 
int DetectOnly ()
 
int DetectOnly (double adjust_threshold)
 
void GetDetectResult (double[] result)
 
void GetDetectResult (Span< double > result)
 
List< Vector2 > DetectLandmark (double left, double top, double width, double height)
 
List< Vector2 > DetectLandmark (Rect rect)
 
double [] DetectLandmarkArray (double left, double top, double width, double height)
 
double [] DetectLandmarkArray (Rect rect)
 
int DetectLandmarkOnly (double left, double top, double width, double height)
 
int DetectLandmarkOnly (Rect rect)
 
void GetDetectLandmarkResult (double[] result)
 
void GetDetectLandmarkResult (Span< double > result)
 
bool IsAllPartsInRect ()
 
long GetShapePredictorNumParts ()
 
long GetShapePredictorNumFeatures ()
 
void DrawDetectResult (Texture2D texture2D, int r, int g, int b, int a, int thickness, bool updateMipmaps=false, bool makeNoLongerReadable=false)
 
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)
 
void DrawDetectResult (IntPtr intPtr, int width, int height, int bytesPerPixel, int r, int g, int b, int a, int thickness)
 
void DrawDetectResult (IntPtr intPtr, int width, int height, int bytesPerPixel, bool flip, int r, int g, int b, int a, int thickness)
 
void DrawDetectResult< T > (T[] array, int width, int height, int bytesPerPixel, int r, int g, int b, int a, int thickness)
 
void DrawDetectResult< T > (T[] array, int width, int height, int bytesPerPixel, bool flip, int r, int g, int b, int a, int thickness)
 
void DrawDetectLandmarkResult (Texture2D texture2D, int r, int g, int b, int a, bool updateMipmaps=false, bool makeNoLongerReadable=false)
 
void DrawDetectLandmarkResult (Texture2D texture2D, int r, int g, int b, int a, Color32[] pixels32Buffer, byte[] rawTextureDataBuffer=null, bool updateMipmaps=false, bool makeNoLongerReadable=false)
 
void DrawDetectLandmarkResult (IntPtr intPtr, int width, int height, int bytesPerPixel, int r, int g, int b, int a)
 
void DrawDetectLandmarkResult (IntPtr intPtr, int width, int height, int bytesPerPixel, bool flip, int r, int g, int b, int a)
 
void DrawDetectLandmarkResult< T > (T[] array, int width, int height, int bytesPerPixel, int r, int g, int b, int a)
 
void DrawDetectLandmarkResult< T > (T[] array, int width, int height, int bytesPerPixel, bool flip, int r, int g, int b, int a)
 
- Public Member Functions inherited from DlibFaceLandmarkDetector.DisposableObject
void Dispose ()
 
void ThrowIfDisposed ()
 

Protected Member Functions

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

Additional Inherited Members

- 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 default frontal face detector.

ObjectDetector is initialized in such a code. frontal_face_detector face_detector; face_detector = get_frontal_face_detector();

ShapePredictor is initialized in such a code. shape_predictor sp; deserialize(shape_predictor_filename) >> sp;

Parameters
shapePredictorFilePath

◆ FaceLandmarkDetector() [2/2]

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

Initializes a new instance of the FaceLandmarkDetector class.

ObjectDetector is initialized in such a 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 in such a code. shape_predictor sp; deserialize(shape_predictor_filename) >> sp;

Parameters
objectDetectorFilePath
shapePredictorFilePath

Member Function Documentation

◆ Detect() [1/2]

List<Rect> DlibFaceLandmarkDetector.FaceLandmarkDetector.Detect ( )

Detects Objects.

Returns
List<Rect> detected list of object's rect.

◆ Detect() [2/2]

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

Detects Objects.

Parameters
adjust_threshold
Returns
List<Rect> detected list of object's rect.

◆ DetectArray() [1/2]

double [] DlibFaceLandmarkDetector.FaceLandmarkDetector.DetectArray ( )

Detects Objects.

Returns
double[] detected object's data.[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.

Parameters
adjust_threshold
Returns
double[] detected object's data.[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/2]

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

Detects Object Landmark.

Parameters
left
top
width
height
Returns
List<Vector2> detected Vector2 list of object landmark.

◆ DetectLandmark() [2/2]

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

Detects Object Landmark.

Parameters
rect
Returns
List<Vector2> detected Vector2 list of object landmark.

◆ DetectLandmarkArray() [1/2]

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

Detects Object Landmark.

Parameters
left
top
width
height
Returns
double[] detected object landmark data.[x_0, y_0, x_1, y_1, ...]

◆ DetectLandmarkArray() [2/2]

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

Detects Object Landmark.

Parameters
rect
Returns
double[] detected object landmark data.[x_0, y_0, x_1, y_1, ...]

◆ DetectLandmarkOnly() [1/2]

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

Detects Objects and returns the number of Objects Landmark.

Parameters
left
top
width
height
Returns
int Number of objects detected.

◆ DetectLandmarkOnly() [2/2]

int DlibFaceLandmarkDetector.FaceLandmarkDetector.DetectLandmarkOnly ( Rect  rect)

Detects Objects and returns the number of Objects Landmark.

Parameters
rect
Returns
int Number of objects detected.

◆ DetectOnly() [1/2]

int DlibFaceLandmarkDetector.FaceLandmarkDetector.DetectOnly ( )

Detects Objects and returns the number of Objects detected.

Returns
int 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_threshold
Returns
int Number of objects detected

◆ DetectRectDetection() [1/2]

List<RectDetection> DlibFaceLandmarkDetector.FaceLandmarkDetector.DetectRectDetection ( )

Detects Objects.

Returns
List<RectDetection> detected list of object's RectDetection.

◆ DetectRectDetection() [2/2]

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

Detects Objects.

Parameters
adjust_threshold
Returns
List<RectDetection> detected list of object's RectDetection.

◆ Dispose()

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

◆ DrawDetectLandmarkResult() [1/4]

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

Draws Detect Landmark Result.

Parameters
texture2D
r
g
a
updateMipmapswhen set to true, mipmap levels are recalculated.
makeNoLongerReadablewhen set to true, system memory copy of a texture is released.

◆ DrawDetectLandmarkResult() [2/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 Detect Landmark Result.

Parameters
texture2DProcessing speed is fastest when TextureFormat is RGBA32, RGB24, or Alpha8.
r
g
b
a
pixels32Bufferthe optional array to receive pixels32 data. You can optionally pass in an array of Color32s to avoid allocating new memory each frame. The array needs to be initialized to a length matching width * height of the texture. (http://docs.unity3d.com/ScriptReference/WebCamTexture.GetPixels32.html)
rawTextureDataBufferthe optional array to receive raw texture data. You can optionally pass in an array of bytes to avoid allocating new memory each frame. The array needs to be initialized to a length matching raw data of the texture. (https://docs.unity3d.com/ScriptReference/Texture2D.GetRawTextureData.html)
updateMipmapswhen set to true, mipmap levels are recalculated.
makeNoLongerReadablewhen set to true, system memory copy of a texture is released.

◆ DrawDetectLandmarkResult() [3/4]

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

Draws Detect Landmark Result.

Parameters
intPtr
width
height
bytesPerPixel1 ,3 or 4
r
g
b
a

◆ DrawDetectLandmarkResult() [4/4]

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

Draws Detect Landmark Result.

Parameters
intPtr
width
height
bytesPerPixel1 , 3 or 4
flipflip vertical
r
g
b
a

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

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

Draws Detect Landmark Result.

Parameters
array
width
height
bytesPerPixel1 , 3 or 4
r
g
b
a
Type Constraints
T :struct 

◆ DrawDetectLandmarkResult< T >() [2/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 Detect Landmark Result.

Parameters
array
width
height1 , 3 or 4 flip vertical
r
g
b
a
Type Constraints
T :struct 

◆ DrawDetectResult() [1/4]

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

Draws Detect Result.

Parameters
texture2D
r
g
b
a
thickness
updateMipmapswhen set to true, mipmap levels are recalculated.
makeNoLongerReadablewhen set to true, system memory copy of a texture is released.

◆ DrawDetectResult() [2/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 Detect Result.

Parameters
texture2DProcessing speed is fastest when TextureFormat is RGBA32, RGB24, or Alpha8.
r
g
b
a
thickness
pixels32Bufferthe optional array to receive pixels32 data. You can optionally pass in an array of Color32s to avoid allocating new memory each frame. The array needs to be initialized to a length matching width * height of the texture. (http://docs.unity3d.com/ScriptReference/WebCamTexture.GetPixels32.html)
rawTextureDataBufferthe optional array to receive raw texture data. You can optionally pass in an array of bytes to avoid allocating new memory each frame. The array needs to be initialized to a length matching raw data of the texture. (https://docs.unity3d.com/ScriptReference/Texture2D.GetRawTextureData.html)
updateMipmapswhen set to true, mipmap levels are recalculated.
makeNoLongerReadablewhen set to true, system memory copy of a texture is released.

◆ DrawDetectResult() [3/4]

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

Draws Detect Result.

Parameters
intPtr
width
height1 , 3 or 4
r
g
b
a
thickness

◆ DrawDetectResult() [4/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 Detect Result.

Parameters
intPtr
width
height
bytesPerPixel1 , 3 or 4
flipflip vertical
r
g
b
a
thickness

◆ DrawDetectResult< T >() [1/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 Detect Result.

Parameters
array
width
height
bytesPerPixel1 , 3 or 4
r
g
b
a
thickness
Type Constraints
T :struct 

◆ DrawDetectResult< T >() [2/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 Detect Result.

Parameters
array
width
height
bytePerPixel1 , 3 or 4
flipflip vertical
r
g
b
a
thickness
Type Constraints
T :struct 

◆ GetDetectLandmarkResult() [1/2]

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

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

Parameters
resultdetected object landmark data.[x_0, y_0, x_1, y_1, ...]

◆ GetDetectLandmarkResult() [2/2]

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

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

Parameters
resultdetected object landmark data.[x_0, y_0, x_1, y_1, ...]

◆ GetDetectResult() [1/2]

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

Get 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
resultdetected object's data.[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, ...]

◆ GetDetectResult() [2/2]

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

Get 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
resultdetected object's data.[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, ...]

◆ GetShapePredictorNumFeatures()

long DlibFaceLandmarkDetector.FaceLandmarkDetector.GetShapePredictorNumFeatures ( )

Gets ShapePredictorNumFeatures.

Returns
long

◆ GetShapePredictorNumParts()

long DlibFaceLandmarkDetector.FaceLandmarkDetector.GetShapePredictorNumParts ( )

Gets ShapePredictorNumParts.

Returns
long

◆ IsAllPartsInRect()

bool DlibFaceLandmarkDetector.FaceLandmarkDetector.IsAllPartsInRect ( )

Whether all of the object parts point is contained in the object rectangle?

Returns
bool

◆ SetImage() [1/5]

void DlibFaceLandmarkDetector.FaceLandmarkDetector.SetImage ( Texture2D  texture2D)

Sets Image from Texture2D.

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

◆ SetImage() [2/5]

void DlibFaceLandmarkDetector.FaceLandmarkDetector.SetImage ( WebCamTexture  webCamTexture)

Sets Image from WebCamTexture.

Parameters
webCamTexture

◆ SetImage() [3/5]

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

Sets Image from WebCamTexture.

Parameters
webCamTexture
pixels32Bufferthe optional array to receive pixel data. You can optionally pass in an array of Color32s to avoid allocating new memory each frame. The array needs to be initialized to a length matching width * height of the texture.(http://docs.unity3d.com/ScriptReference/WebCamTexture.GetPixels32.html)

◆ SetImage() [4/5]

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

Sets Image from IntPtr.

Parameters
intPtr
width
height
bytesPerPixel1 , 3 or 4

◆ SetImage() [5/5]

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

Sets Image from IntPtr.

Parameters
intPtr
width
height
bytesPerPixel1 , 3 or 4
flipflip vertical

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

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

Sets Image from Pixel Data Array.

Parameters
array
width
height
bytesPerPixel1 , 3 or 4
Type Constraints
T :struct 

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

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

Sets Image from Pixel Data Array.

Parameters
array
width
height
bytesPerPixel1 , 3 or 4
flipflip vertical
Type Constraints
T :struct 

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