Redaguoti

Bendrinti naudojant


Smart-cropped thumbnails (version 4.0 preview)

A thumbnail is a reduced-size representation of an image. Thumbnails are used to represent images and other data in a more economical, layout-friendly way. The Azure AI Vision 4.0 API uses smart cropping to create intuitive image thumbnails that include the most important regions of an image with priority given to any detected faces.

The Azure AI Vision smart-cropping utility takes one or more aspect ratios in the range [0.75, 1.80] and returns the bounding box coordinates (in pixels) of the region(s) identified. Your app can then crop and return the image using those coordinates.

Important

This feature uses face detection to help determine important regions in the image. The detection does not involve distinguishing one face from another face, predicting or classifying facial attributes, or creating a facial template (a unique set of numbers generated from an image that represents the distinctive features of a face).

Examples

The generated bounding box can vary widely depending on what you specify for aspect ratio, as shown in the following images.

Aspect ratio Bounding box
original Photo of a man with a dog at a table.
0.75 Photo of a man with a dog at a table. A 0.75 ratio bounding box is drawn.
1.00 Photo of a man with a dog at a table. A 1.00 ratio bounding box is drawn.
1.50 Photo of a man with a dog at a table. A 1.50 ratio bounding box is drawn.

Use the API

The smart cropping feature is available through the Analyze Image 4.0 API. Include SmartCrops in the features query parameter. Also include a smartcrops-aspect-ratios query parameter, and set it to a decimal value for the aspect ratio you want (defined as width / height) in the range [0.75, 1.80]. Multiple aspect ratio values should be comma-separated. If no aspect ratio value is provided the API will return a crop with an aspect ratio that best preserves the image’s most important region.

Next steps