Table of Contents

Class SegmentImageConfig

Namespace
Google.GenAI.Types
Assembly
Google.GenAI.dll

Configuration for segmenting an image.

public record SegmentImageConfig : IEquatable<SegmentImageConfig>
Inheritance
SegmentImageConfig
Implements
Inherited Members

Properties

BinaryColorThreshold

The binary color threshold to apply to the masks. The threshold can be set to a decimal value between 0 and 255 non-inclusive. Set to -1 for no binary color thresholding.

[JsonPropertyName("binaryColorThreshold")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? BinaryColorThreshold { get; set; }

Property Value

double?

ConfidenceThreshold

The confidence score threshold for the detections as a decimal value. Only predictions with a confidence score higher than this threshold will be returned.

[JsonPropertyName("confidenceThreshold")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? ConfidenceThreshold { get; set; }

Property Value

double?

HttpOptions

Used to override HTTP request options.

[JsonPropertyName("httpOptions")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public HttpOptions? HttpOptions { get; set; }

Property Value

HttpOptions

Labels

User specified labels to track billing usage.

[JsonPropertyName("labels")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public Dictionary<string, string>? Labels { get; set; }

Property Value

Dictionary<string, string>

MaskDilation

A decimal value representing how much dilation to apply to the masks. 0 for no dilation. 1.0 means the masked area covers the whole image.

[JsonPropertyName("maskDilation")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? MaskDilation { get; set; }

Property Value

double?

MaxPredictions

The maximum number of predictions to return up to, by top confidence score.

[JsonPropertyName("maxPredictions")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? MaxPredictions { get; set; }

Property Value

int?

Mode

The segmentation mode to use.

[JsonPropertyName("mode")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public SegmentMode? Mode { get; set; }

Property Value

SegmentMode?

Methods

FromJson(string, JsonSerializerOptions?)

Deserializes a JSON string to a SegmentImageConfig object.

public static SegmentImageConfig? FromJson(string jsonString, JsonSerializerOptions? options = null)

Parameters

jsonString string

The JSON string to deserialize.

options JsonSerializerOptions

Optional JsonSerializerOptions.

Returns

SegmentImageConfig

The deserialized SegmentImageConfig object, or null if deserialization fails.