# SelfieSegmenterOptions.Builder

public static class **SelfieSegmenterOptions.Builder** extends [Object](https://developer.android.com/reference/java/lang/Object.html)  
Builder for `https://developers.google.com/android/reference/com/google/mlkit/vision/segmentation/selfie/SelfieSegmenterOptions`.

### Public Constructor Summary

|---|---|
|   | [Builder](https://developers.google.com/android/reference/com/google/mlkit/vision/segmentation/selfie/SelfieSegmenterOptions.Builder#Builder())() |

### Public Method Summary

|---|---|
| [SelfieSegmenterOptions](https://developers.google.com/android/reference/com/google/mlkit/vision/segmentation/selfie/SelfieSegmenterOptions) | [build](https://developers.google.com/android/reference/com/google/mlkit/vision/segmentation/selfie/SelfieSegmenterOptions.Builder#build())() |
| [SelfieSegmenterOptions.Builder](https://developers.google.com/android/reference/com/google/mlkit/vision/segmentation/selfie/SelfieSegmenterOptions.Builder) | [enableRawSizeMask](https://developers.google.com/android/reference/com/google/mlkit/vision/segmentation/selfie/SelfieSegmenterOptions.Builder#enableRawSizeMask())() Asks the segmenter to return the raw size mask which matches the model output size. |
| [SelfieSegmenterOptions.Builder](https://developers.google.com/android/reference/com/google/mlkit/vision/segmentation/selfie/SelfieSegmenterOptions.Builder) | [setDetectorMode](https://developers.google.com/android/reference/com/google/mlkit/vision/segmentation/selfie/SelfieSegmenterOptions.Builder#setDetectorMode(int))(int detectorMode) Sets the detector mode to be either `https://developers.google.com/android/reference/com/google/mlkit/vision/segmentation/selfie/SelfieSegmenterOptions#STREAM_MODE` or `https://developers.google.com/android/reference/com/google/mlkit/vision/segmentation/selfie/SelfieSegmenterOptions#SINGLE_IMAGE_MODE`. |
| [SelfieSegmenterOptions.Builder](https://developers.google.com/android/reference/com/google/mlkit/vision/segmentation/selfie/SelfieSegmenterOptions.Builder) | [setExecutor](https://developers.google.com/android/reference/com/google/mlkit/vision/segmentation/selfie/SelfieSegmenterOptions.Builder#setExecutor(java.util.concurrent.Executor))([Executor](https://developer.android.com/reference/java/util/concurrent/Executor.html) executor) Sets the custom `https://developer.android.com/reference/java/util/concurrent/Executor.html` to use. |

### Inherited Method Summary

From class java.lang.Object

|---|---|
| [Object](https://developer.android.com/reference/java/lang/Object.html) | clone() |
| boolean | equals([Object](https://developer.android.com/reference/java/lang/Object.html) arg0) |
| void | finalize() |
| final [Class](https://developer.android.com/reference/java/lang/Class.html)\<?\> | getClass() |
| int | hashCode() |
| final void | notify() |
| final void | notifyAll() |
| [String](https://developer.android.com/reference/java/lang/String.html) | toString() |
| final void | wait(long arg0, int arg1) |
| final void | wait(long arg0) |
| final void | wait() |

## Public Constructors

#### public **Builder** ()

## Public Methods

#### public [SelfieSegmenterOptions](https://developers.google.com/android/reference/com/google/mlkit/vision/segmentation/selfie/SelfieSegmenterOptions) **build**
()

#### public [SelfieSegmenterOptions.Builder](https://developers.google.com/android/reference/com/google/mlkit/vision/segmentation/selfie/SelfieSegmenterOptions.Builder) **enableRawSizeMask** ()

Asks the segmenter to return the raw size mask which matches the model output
size.

The raw mask size (e.g. 256x256) is usually smaller than the `https://developers.google.com/android/reference/com/google/mlkit/vision/common/InputImage`
size. Please call `https://developers.google.com/android/reference/com/google/mlkit/vision/segmentation/SegmentationMask#getWidth()` and `https://developers.google.com/android/reference/com/google/mlkit/vision/segmentation/SegmentationMask#getHeight()` to get the size when enabling this option.

Without specifying this option, the segmenter will rescale the raw mask to match the
input image size. Consider using this option if you want to apply customized rescaling
logic or rescaling is not needed for your use case.

#### public [SelfieSegmenterOptions.Builder](https://developers.google.com/android/reference/com/google/mlkit/vision/segmentation/selfie/SelfieSegmenterOptions.Builder) **setDetectorMode** (int detectorMode)

Sets the detector mode to be either `https://developers.google.com/android/reference/com/google/mlkit/vision/segmentation/selfie/SelfieSegmenterOptions#STREAM_MODE` or `https://developers.google.com/android/reference/com/google/mlkit/vision/segmentation/selfie/SelfieSegmenterOptions#SINGLE_IMAGE_MODE`.

By default, it is `https://developers.google.com/android/reference/com/google/mlkit/vision/segmentation/selfie/SelfieSegmenterOptions#STREAM_MODE`.

For more details about use cases of each mode, please check the documentation of
`https://developers.google.com/android/reference/com/google/mlkit/vision/segmentation/selfie/SelfieSegmenterOptions#STREAM_MODE` and `https://developers.google.com/android/reference/com/google/mlkit/vision/segmentation/selfie/SelfieSegmenterOptions#SINGLE_IMAGE_MODE`.

#### public [SelfieSegmenterOptions.Builder](https://developers.google.com/android/reference/com/google/mlkit/vision/segmentation/selfie/SelfieSegmenterOptions.Builder) **setExecutor** ([Executor](https://developer.android.com/reference/java/util/concurrent/Executor.html) executor)

Sets the custom `https://developer.android.com/reference/java/util/concurrent/Executor.html`
to use. If no `https://developer.android.com/reference/java/util/concurrent/Executor.html`
is set, an internal background thread pool will be used.

Most clients should not need to call this method.