Edit

class ImageAnalysis::ImageAnalysisResult

class ImageAnalysis::ImageAnalysisResult
  : public Core::_detail::ResultBase< ImageAnalysisCoreResultReason, ImageAnalysisResultProperties >

Represents the outcome of an Image Analysis operation.

Always start by calling GetReason to determine if the analysis operation was successful or not. When an analysis operation is successful, applicable Get methods in this object will return results based on the selected features (ImageAnalysisOptions::SetFeatures) or custom-trained model (ImageAnalysisOptions::SetModelName). These results are parsed from the service JSON response. Other Get methods will return a Nullable result objects with no value. We use the Nullable class to hold a result, as a convenient container that can indicate if a result has value (see Nullable::HasValue). Call ImageAnalysisResultDetails::FromResult to get access to additional information about the result, such as the raw JSON response. When analysis operation failed, call ImageAnalysisErrorDetails::FromResult to get access to additional information about the error.

Members

Properties

Syntax: public const ImageAnalysisResultProperties & Properties;

Gets a collection of additional properties on the result.

~ImageAnalysisResult

Syntax: public ~ImageAnalysisResult ( ) = default;

Destructs an instance of the ImageAnalysisResult class.

GetReason

Syntax: public inline ImageAnalysisResultReason GetReason ( ) const;

Gets a value indicating why this result was generated.

Returns

Reason of this result.

GetModelVersion

Syntax: public inline Nullable< std::string > GetModelVersion ( );

Gets the model version used by the Image Analysis Service to create this result.

Returns

The version of the model.

GetImageHeight

Syntax: public inline Nullable< int32_t > GetImageHeight ( );

Gets the height, in pixels, of the analyzed image.

Returns

A Nullable object holding an int32_t value representing the height, or an empty value

Only populated if the image was analyzed successfully

GetImageWidth

Syntax: public inline Nullable< int32_t > GetImageWidth ( );

Gets the width, in pixels, of the analyzed image. Only populated if the image was analyzed successfully.

Returns

A Nullable object holding an int32_t value representing the width, or an empty value

GetCaption

Syntax: public inline Nullable< ContentCaption > GetCaption ( );

Gets a generated phrase that describes the content of the analyzed image.

This result will only be populated if ImageAnalysisFeature::Caption was included while calling ImageAnalysisOptions::SetFeatures.

Returns

A Nullable object holding the ContentCaption result or an empty value

GetDenseCaptions

Syntax: public inline Nullable< DenseCaptions > GetDenseCaptions ( );

Gets up to 10 generated phrases, the first describing the content of the whole image, and the others describing the content of different regions of the image.

This result will only be populated if ImageAnalysisFeature::DenseCaptions was included while calling ImageAnalysisOptions::SetFeatures.

Returns

A Nullable object holding the DenseCaptions result or an empty value

GetObjects

Syntax: public inline Nullable< DetectedObjects > GetObjects ( );

Gets a list of detected objects from the analyzed image.

This result will only be populated if ImageAnalysisFeature::Objects was included while calling ImageAnalysisOptions::SetFeatures.

Returns

A Nullable object holding the DetectedObjects result or an empty value

Returns

GetCustomObjects

Syntax: public inline Nullable< DetectedObjects > GetCustomObjects ( );

Gets a list of detected objects from the analyzed image using the provided custom-trained model.

This result may be populated if ImageAnalysisOptions::SetModelName was called, and the provided custom model was trained to detect objects.

Returns

A Nullable object holding the DetectedObjects result or an empty value

Returns

GetText

Syntax: public inline Nullable< DetectedText > GetText ( );

Gets a collection of extracted textual lines and words from an analyzed image.

This result will only be populated if ImageAnalysisFeature::Text was included while calling ImageAnalysisOptions::SetFeatures.

Returns

A Nullable object holding the DetectedText result or an empty value.

GetTags

Syntax: public inline Nullable< ContentTags > GetTags ( );

Gets a list of content tag detections from the analyzed image.

This result will only be populated if ImageAnalysisFeature::Tags was included while calling ImageAnalysisOptions::SetFeatures.

Returns

A Nullable object holding the ContentTags result or an empty value.

GetCustomTags

Syntax: public inline Nullable< ContentTags > GetCustomTags ( );

Gets a list of content tag detections from the analyzed image using the provided custom-trained model.

This result may be populated if ImageAnalysisOptions::SetModelName was called, and the provided custom model was trained to detect tags.

Returns

A Nullable object holding the ContentTags result or an empty value.

GetPeople

Syntax: public inline Nullable< DetectedPeople > GetPeople ( );

Gets a list of detected people from an analyzed image.

This result will only be populated if ImageAnalysisFeature::People was included while calling ImageAnalysisOptions::SetFeatures.

Returns

A Nullable object holding the DetectedPeople result or an empty value.

GetCropSuggestions

Syntax: public inline Nullable< CropSuggestions > GetCropSuggestions ( );

Gets a list of suggested image crop operations of the analyzed image at the desired aspect ratios (if provided)

Also knows as SmartCrops. These cropping suggestions preserve as much content as possible while achieving the specified aspect ratios (if provided).

This result will only be populated if ImageAnalysisFeature::CropSuggestions was included while calling ImageAnalysisOptions::SetFeatures.

Optionally, specify one or more desired cropping aspect ratios by calling ImageAnalysisOptions::SetCroppingAspectRatios. If CroppingAspectRatios is not set, the Service will return one crop suggestion with an aspect ratio it sees fit.

Returns

A Nullable object holding the CropSuggestions result or an empty value.

GetSegmentationResult

Syntax: public inline Nullable< SegmentationResult > GetSegmentationResult ( );

Get the result of the image segmentation operation.

This result will only be populated if ImageAnalysisOptions::SetSegmentationMode() was called with either ImageSegmentationMode::BackgroundRemoval or ImageSegmentationMode::ForegroundMatting.

Returns

A Nullable object holding the SegmentationResult or an empty value.