FaceDetector class
Detects human faces in images.
- Implemented types
Constructors
- FaceDetector()
- Creates a new instance of the FaceDetector class.
-
FaceDetector.fromHandle(Pointer<
id3FaceDetector> handle) - Creates a new instance of the FaceDetector class.
Properties
- confidenceThreshold ↔ int
-
Confidence threshold, in the range
0;100. Hint: Default value is 50. Note: Setting a high threshold reduces false detection but can increase the number of undetected faces.getter/setter pair -
handle
→ Pointer<
id3FaceDetector> -
Gets the native handle.
return The native handle.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- model ↔ FaceModel
-
Model used to detect and track faces.
Hint: Default value is FaceDetector4A which is the best available algorithm in this SDK in terms of accuracy. Some better accuracy/speed balances can be found by choosing another model.
getter/setter pair
- nmsIouThreshold ↔ int
-
Non-maximum suppression (NMS) intersection-over-union (IOU) threshold, in the range is
0;100. Hint: Default value is 40. Note: Setting a high threshold allows to detect more overlapping faces which can be useful in a multi-face scenario. On the contrary, in a portrait scenario, a low NMS IOU threshold should be preferred.getter/setter pair - processingUnit ↔ ProcessingUnit
-
Processing unit where to run the detection process.
Hint: Default value is CPU.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- threadCount ↔ int
-
Number of threads to be used for face detection.
Hint: Default value is 1. Allocating more than one thread can increase the speed of the process.
getter/setter pair
Methods
-
detectFaces(
Image image) → DetectedFaceList -
Detects faces in an image and store their info in a DetectedFaceList object.
Note: The algorithm searches for faces in the range (16px;512px). If the image is too large to fit this range, one must resize it before the detection process.
Important: Loading a
FaceDetectormodel is required to use this function. -
dispose(
) → void - Releases all resources used by this FaceDetector.
-
getConfidenceThreshold(
) → int - Gets the confidence threshold, in the range (0;100). Hint: Default value is 50. Note: Setting a high threshold reduces false detection but can increase the number of undetected faces.
-
getModel(
) → FaceModel - Gets the model used to detect and track faces. Hint: Default value is FaceDetector4A which is the best available algorithm in this SDK in terms of accuracy. Some better accuracy/speed balances can be found by choosing another model.
-
getNmsIouThreshold(
) → int - Gets the non-maximum suppression (NMS) intersection-over-union (IOU) threshold, in the range is (0;100). Hint: Default value is 40. Note: Setting a high threshold allows to detect more overlapping faces which can be useful in a multi-face scenario. On the contrary, in a portrait scenario, a low NMS IOU threshold should be preferred.
-
getProcessingUnit(
) → ProcessingUnit - Gets the processing unit where to run the detection process. Hint: Default value is CPU.
-
getThreadCount(
) → int - Gets the number of threads to be used for face detection. Hint: Default value is 1. Allocating more than one thread can increase the speed of the process.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setConfidenceThreshold(
int confidenceThreshold) → void - Sets the confidence threshold, in the range (0;100). Hint: Default value is 50. Note: Setting a high threshold reduces false detection but can increase the number of undetected faces.
-
setModel(
FaceModel model) → void - Sets the model used to detect and track faces. Hint: Default value is FaceDetector4A which is the best available algorithm in this SDK in terms of accuracy. Some better accuracy/speed balances can be found by choosing another model.
-
setNmsIouThreshold(
int nmsIouThreshold) → void - Sets the non-maximum suppression (NMS) intersection-over-union (IOU) threshold, in the range is (0;100). Hint: Default value is 40. Note: Setting a high threshold allows to detect more overlapping faces which can be useful in a multi-face scenario. On the contrary, in a portrait scenario, a low NMS IOU threshold should be preferred.
-
setProcessingUnit(
ProcessingUnit processingUnit) → void - Sets the processing unit where to run the detection process. Hint: Default value is CPU.
-
setThreadCount(
int threadCount) → void - Sets the number of threads to be used for face detection. Hint: Default value is 1. Allocating more than one thread can increase the speed of the process.
-
toString(
) → String -
A string representation of this object.
inherited
-
trackFaces(
Image image, DetectedFaceList detectedFaceList) → void -
Tracks faces in an image and update their info in a DetectedFaceList object.
In a realtime process, one must use this function instead of DetectFaces() to keep the face IDs stable in time.
Note: The algorithm searches for faces in the range (16px;512px). If the image is too large to fit this range, one must resize it before the detection process.
Important: Loading a
FaceDetectormodel is required to use this function. Warning: This function is deprecated: use the FaceTracker module instead. -
warmUp(
int imageWidth, int imageHeight) → void -
Gets the face detector module ready to work on a specific image size by initializing all its internal memory layout.
This function can be called after setting all the parameters of the face detector module if the image size is fixed, for example using frames from a video stream.
Calling this function is not mandatory as the internal memory layout is automatically initialized in the first call to detectFaces() or trackFaces() if missing.
Important: Loading a
FaceDetectormodel is required to use this function.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited