다음을 통해 공유


CropRegion Class

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

Implements

public final class CropRegion
implements JsonSerializable<CropRegion>

A region at the desired aspect ratio that can be used as image thumbnail. The region preserves as much content as possible from the analyzed image, with priority given to detected faces.

Method Summary

Modifier and Type Method and Description
static CropRegion fromJson(JsonReader jsonReader)

Reads an instance of CropRegion from the JsonReader.

double getAspectRatio()

Get the aspectRatio property: The aspect ratio of the crop region.

ImageBoundingBox getBoundingBox()

Get the boundingBox property: The bounding box of the region.

JsonWriter toJson(JsonWriter jsonWriter)

Methods inherited from java.lang.Object

Method Details

fromJson

public static CropRegion fromJson(JsonReader jsonReader)

Reads an instance of CropRegion from the JsonReader.

Parameters:

jsonReader - The JsonReader being read.

Returns:

An instance of CropRegion if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.

Throws:

IOException

- If the deserialized JSON object was missing any required properties.

getAspectRatio

public double getAspectRatio()

Get the aspectRatio property: The aspect ratio of the crop region. Aspect ratio is calculated by dividing the width of the region in pixels by its height in pixels. The aspect ratio will be in the range 0.75 to 1.8 (inclusive) if provided by the developer during the analyze call. Otherwise, it will be in the range 0.5 to 2.0 (inclusive).

Returns:

the aspectRatio value.

getBoundingBox

public ImageBoundingBox getBoundingBox()

Get the boundingBox property: The bounding box of the region.

Returns:

the boundingBox value.

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

Applies to