[](https://github.com/OTheDev/az_analyze_image) [![Multi-Platform Test](https://github.com/OTheDev/az_analyze_image/actions/workflows/test_with_key.yml/badge.svg?branch=main)](https://github.com/OTheDev/az_analyze_image/actions/workflows/test_with_key.yml) [![Static Analysis](https://github.com/OTheDev/az_analyze_image/actions/workflows/static.yml/badge.svg?branch=main)](https://github.com/OTheDev/az_analyze_image/actions/workflows/static.yml) # az_analyze_image Rust client library for Azure AI Services Analyze Image (Image Analysis) REST APIs, versions [3.2](https://learn.microsoft.com/en-us/rest/api/computervision/analyze-image/analyze-image?view=rest-computervision-v3.2&tabs=HTTP) and [4.0](https://learn.microsoft.com/en-us/rest/api/computervision/image-analysis/analyze-image?view=rest-computervision-v4.0-preview%20(2023-04-01)&tabs=HTTP) (`2023-04-01-preview`). ## See also - [What is Image Analysis?](https://learn.microsoft.com/en-us/azure/ai-services/computer-vision/overview-image-analysis?tabs=3-2) - Analyze Image - [API Version 3.2](https://learn.microsoft.com/en-us/rest/api/computervision/analyze-image/analyze-image?view=rest-computervision-v3.2&tabs=HTTP) - [API Version 4.0](https://learn.microsoft.com/en-us/rest/api/computervision/image-analysis/analyze-image?view=rest-computervision-v4.0-preview%20(2023-04-01)&tabs=HTTP) (`2023-04-01-preview`) ## License This project is dual-licensed under either the [Apache License, Version 2.0](https://github.com/OTheDev/az_analyze_image/blob/main/LICENSE-APACHE) or the [MIT License](https://github.com/OTheDev/az_analyze_image/blob/main/LICENSE-MIT), at your option. ## Contributing Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you shall be dual-licensed as above, without any additional terms or conditions. ## Example - Detect People in an Image In the [detect people](https://github.com/OTheDev/az_analyze_image/tree/main/examples/detect_people) example, the Analyze Image API is used to detect people in an image. For each detected person, the API returns a bounding box (defines a rectangle in the image) and a confidence level. This example draws the bounding boxes on the image for detected persons with confidence greater than 0.75 and saves it to `out.jpg`:
```rust use az_analyze_image::v40::client::{AnalyzeImageOptions, Client}; use az_analyze_image::v40::{DetectedPerson, VisualFeature}; use image::{load_from_memory_with_format, ImageFormat, Rgb, RgbImage}; use imageproc::drawing::draw_hollow_rect_mut; use imageproc::rect::Rect; use reqwest::Client as ReqwestClient; use std::env::var; use std::error::Error; const IMAGE_URL: &str = "https://images.pexels.com/photos/1367269/pexels-photo-1367269.jpeg"; // Pixel thickness for rectangle boundaries. const THICKNESS: u32 = 8; // Colors for each rectangle boundary. If there's more people than COLORS.len(), // then we wrap around. const COLORS: &[Rgb