0PricingLogin
Azure Fundamentals · Lesson

Language and Vision APIs in Practice

Call the Computer Vision API to analyse an image and the Text Analytics API to extract sentiment and key phrases from customer reviews using REST requests.

Calling the Computer Vision API

The Computer Vision API (/vision/v3.2/analyze) analyses an image URL or binary stream and returns a rich JSON response containing detected objects, a scene description in natural language, dominant colours, and whether the image contains adult content. You specify which visual features you want — Categories, Description, Objects, Tags, Faces, Color, Adult — to control what the API computes and pay only for what you use.

# Analyse an image URL with Computer Vision
curl -X POST 'https://myVision.cognitiveservices.azure.com/vision/v3.2/analyze?visualFeatures=Description,Objects,Tags' \
  -H 'Ocp-Apim-Subscription-Key: <key>' \
  -H 'Content-Type: application/json' \
  -d '{"url": "https://upload.wikimedia.org/wikipedia/commons/thumb/3/3a/Cat03.jpg/1200px-Cat03.jpg"}'

OCR: Reading Text from Images

The Read API (/vision/v3.2/read/analyze) is the recommended OCR endpoint for extracting text from images and PDFs. Unlike the older /ocr endpoint, the Read API is asynchronous — you submit the image, get back an operation URL, poll it until complete, and then retrieve the result. It supports printed and handwritten text in 164 languages, preserves the reading order of text blocks, and handles rotated or low-resolution images better than the synchronous OCR endpoint.

# Step 1: Submit image for reading
curl -X POST 'https://myVision.cognitiveservices.azure.com/vision/v3.2/read/analyze' \
  -H 'Ocp-Apim-Subscription-Key: <key>' \
  -H 'Content-Type: application/json' \
  -d '{"url": "https://example.com/invoice.jpg"}'
# Returns: Operation-Location header with result URL

# Step 2: Poll for result
curl 'https://myVision.cognitiveservices.azure.com/vision/v3.2/read/analyzeResults/<operation-id>' \
  -H 'Ocp-Apim-Subscription-Key: <key>'

All lessons in this course

  1. Azure Cognitive Services Overview
  2. Language and Vision APIs in Practice
  3. Azure Machine Learning Studio
  4. Azure OpenAI Service
← Back to Azure Fundamentals