FaceDetector.FaceDetectorOptions.Builder

public abstract class FaceDetector.FaceDetectorOptions.Builder


Builder for FaceDetectorOptions.

Summary

Public constructors

Public methods

final FaceDetector.FaceDetectorOptions

Validates and builds the FaceDetectorOptions instance.

abstract FaceDetector.FaceDetectorOptions.Builder

Sets the BaseOptions for the face detector task.

abstract FaceDetector.FaceDetectorOptions.Builder

Sets an optional ErrorListener}.

abstract FaceDetector.FaceDetectorOptions.Builder

Sets the minimum confidence score for the face detection to be considered successful.

abstract FaceDetector.FaceDetectorOptions.Builder

Sets the minimum non-maximum-suppression threshold for face detection to be considered overlapped.

abstract FaceDetector.FaceDetectorOptions.Builder

Sets the ResultListener to receive the detection results asynchronously when the face detector is in the live stream mode.

abstract FaceDetector.FaceDetectorOptions.Builder

Sets the RunningMode for the face detector task.

Public constructors

Builder

public Builder()

Public methods

build

public final FaceDetector.FaceDetectorOptions build()

Validates and builds the FaceDetectorOptions instance.

Throws
java.lang.IllegalArgumentException

if the result listener and the running mode are not properly configured. The result listener should only be set when the face detector is in the live stream mode.

setBaseOptions

public abstract FaceDetector.FaceDetectorOptions.Builder setBaseOptions(BaseOptions value)

Sets the BaseOptions for the face detector task.

setErrorListener

public abstract FaceDetector.FaceDetectorOptions.Builder setErrorListener(ErrorListener value)

Sets an optional ErrorListener}.

setMinDetectionConfidence

public abstract FaceDetector.FaceDetectorOptions.Builder setMinDetectionConfidence(float value)

Sets the minimum confidence score for the face detection to be considered successful. The default minDetectionConfidence is 0.5.

setMinSuppressionThreshold

public abstract FaceDetector.FaceDetectorOptions.Builder setMinSuppressionThreshold(float value)

Sets the minimum non-maximum-suppression threshold for face detection to be considered overlapped. The default minSuppressionThreshold is 0.3.

setResultListener

public abstract FaceDetector.FaceDetectorOptions.Builder setResultListener(
    OutputHandler.ResultListener<FaceDetectorResult, MPImage> value
)

Sets the ResultListener to receive the detection results asynchronously when the face detector is in the live stream mode.

setRunningMode

public abstract FaceDetector.FaceDetectorOptions.Builder setRunningMode(RunningMode value)

Sets the RunningMode for the face detector task. Default to the image mode. face detector has three modes:

  • IMAGE: The mode for detecting faces on single image inputs.
  • VIDEO: The mode for detecting faces on the decoded frames of a video.
  • LIVE_STREAM: The mode for for detecting faces on a live stream of input data, such as from camera. In this mode, setResultListener must be called to set up a listener to receive the detection results asynchronously.