共用方式為


ImageAnalysisOptions Class

  • java.lang.Object
    • com.azure.ai.vision.imageanalysis.models.ImageAnalysisOptions

public final class ImageAnalysisOptions

Options for a single Image Analysis operation.

Constructor Summary

Constructor Description
ImageAnalysisOptions()

Creates an instance of ImageAnalysisOptions class with default analysis options, as specified by the service.

Method Summary

Modifier and Type Method and Description
String getLanguage()

Get the language code

String getModelVersion()

Get the model version

List<Double> getSmartCropsAspectRatios()

Get the smart crop aspect rations

Boolean isGenderNeutralCaption()

Get the gender neutral caption selection

ImageAnalysisOptions setGenderNeutralCaption(Boolean genderNeutralCaption)

Sets the gender-neutral captioning option for visual features CAPTION and DENSE_CAPTIONS.

ImageAnalysisOptions setLanguage(String language)

Sets the desired language for output generation.

ImageAnalysisOptions setModelVersion(String modelVersion)

Set the version of cloud AI-model used for analysis.

ImageAnalysisOptions setSmartCropsAspectRatios(List<Double> smartCropsAspectRatios)

Set a list of aspect ratios for the visual feature SMART_CROPS.

Methods inherited from java.lang.Object

Constructor Details

ImageAnalysisOptions

public ImageAnalysisOptions()

Creates an instance of ImageAnalysisOptions class with default analysis options, as specified by the service. The Language used will be "en" (for English). Gender Neutral Caption is "false". One Smart Crop region with an aspect ratio the service sees fit. Model version is "latest".

Method Details

getLanguage

public String getLanguage()

Get the language code

Returns:

The language code

getModelVersion

public String getModelVersion()

Get the model version

Returns:

The model version

getSmartCropsAspectRatios

public List getSmartCropsAspectRatios()

Get the smart crop aspect rations

Returns:

The smart crop aspect rations

isGenderNeutralCaption

public Boolean isGenderNeutralCaption()

Get the gender neutral caption selection

Returns:

The gender neutral caption selection

setGenderNeutralCaption

public ImageAnalysisOptions setGenderNeutralCaption(Boolean genderNeutralCaption)

Sets the gender-neutral captioning option for visual features CAPTION and DENSE_CAPTIONS. If this parameter is not specified, the default value is "false". By default captions may contain gender terms (for example: 'man', 'woman', or 'boy', 'girl'). If you set this to "true", those will be replaced with gender-neutral terms (for example: 'person' or 'child').

Parameters:

genderNeutralCaption - Set to "true" to get gender neutral captions.

Returns:

Returns the same concrete type with the appropriate properties updated, to allow for fluent chaining of operations.

setLanguage

public ImageAnalysisOptions setLanguage(String language)

Sets the desired language for output generation. At the moment this only applies to the visual feature TAGS. If this parameter is not specified, the default value is "en" for English. See https://aka.ms/cv-languages for a list of supported languages and to which visual feature they apply.

Parameters:

language - The langauge code to set, as specified in https://aka.ms/cv-languages.

Returns:

Returns the same concrete type with the appropriate properties updated, to allow for fluent chaining of operations.

setModelVersion

public ImageAnalysisOptions setModelVersion(String modelVersion)

Set the version of cloud AI-model used for analysis. The format is the following: 'latest' (default value) or 'YYYY-MM-DD' or 'YYYY-MM-DD-preview', where 'YYYY', 'MM', 'DD' are the year, month and day associated with the model. This is not commonly set, as the default always gives the latest AI model with recent improvements. If however you would like to make sure analysis results do not change over time, set this value to a specific model version. Note that the model version is available in the Image Analysis Result (see com.azure.ai.vision.imageanalysis.models.ImageAnalysisResult.getModelVersion).

Parameters:

modelVersion - The model version to set.

Returns:

Returns the same concrete type with the appropriate properties updated, to allow for fluent chaining of operations.

setSmartCropsAspectRatios

public ImageAnalysisOptions setSmartCropsAspectRatios(List smartCropsAspectRatios)

Set a list of aspect ratios for the visual feature SMART_CROPS. Aspect ratios are calculated by dividing the target crop width in pixels by the height in pixels. Supported values are between 0.75 and 1.8 (inclusive). If this parameter is not specified, the service will return one crop region with an aspect ratio it sees fit between 0.5 and 2.0 (inclusive).

Parameters:

smartCropsAspectRatios - The list of aspect ratios to set.

Returns:

Returns the same concrete type with the appropriate properties updated, to allow for fluent chaining of operations.

Applies to