AI-901 ยท Vision and image generation solutions
Analyzing an image with Azure Vision in Python
Reading Python that analyzes an image with Azure Vision features such as captions, tags, object detection and OCR, and mapping each feature to the result it returns.
Key points
- Install azure-ai-vision-imageanalysis, build ImageAnalysisClient(endpoint, AzureKeyCredential(key)), then call analyze_from_url (public URL) or analyze (image bytes) with visual_features.
- Results: caption, dense_captions, tags, objects, read, people, smart_crops.
- Image Analysis 4.0 is marked deprecated, retiring September 25, 2028.
Source: https://learn.microsoft.com/en-us/azure/ai-services/computer-vision/how-to/call-analyze-image-40
Practice questions
Which visual feature returns the text found in an image, line by line?
- VisualFeatures.TAGS
- VisualFeatures.CAPTION
- VisualFeatures.PEOPLE
- VisualFeatures.READ
Show answer
Answer: D. VisualFeatures.READ
READ is the OCR feature and fills result.read with blocks and lines. TAGS lists content labels, CAPTION gives one sentence, PEOPLE returns person boxes.
Which Image Analysis 4.0 results include bounding box coordinates?
- objects
- people
- dense captions
- tags
- a single caption
Show answer
Answer: A. objects, B. people, C. dense captions
Objects, people and dense captions each return a bounding box. Tags and the single caption describe the whole image without locations.
True or false: analyze_from_url can be given the path of a file on the local disk.
Show answer
Answer: False
False. analyze_from_url needs a publicly reachable URL. For local files, read the bytes and call analyze with image_data.
Practice 8 questions on this topic in Bitzu
Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.
