Skip to main content
Welcome to the Analyze and Manipulate Images module. This lesson explains how machines interpret and transform visual content, turning pixels into meaningful data. You will learn practical techniques for recognizing objects, extracting text, improving image quality, and integrating these capabilities into applications using Azure AI and common image-processing libraries. By the end of this module you will be able to design and implement end-to-end image-processing solutions that include preprocessing, analysis (OCR, object/face detection), enhancement, and service integration.

What we’ll cover

  • Fundamentals of image processing: image representation, common preprocessing steps (resizing, normalization, color-space conversion), and filters (blurring, sharpening, edge detection) used to prepare images for analysis.
  • Optical Character Recognition (OCR): extracting readable and structured text from images using Read/OCR APIs and Form Recognizer for structured documents.
  • Object and face detection: identifying objects and people using pre-trained models (Computer Vision, Custom Vision for domain-specific classifiers, and Face API for verification and detection).
  • Image enhancement and manipulation: techniques for adjusting brightness, contrast, sharpness, denoising, and geometric transforms to improve visual quality or prepare inputs for downstream models.
  • Integration patterns: calling image-processing APIs from applications (REST APIs and language SDKs such as Python, C#, and JavaScript), handling results, and designing scalable pipelines for batch and real-time scenarios.

Learning outcomes

After completing this lesson, you will be able to:
  • Explain core image preprocessing techniques and why they matter for analysis models.
  • Use OCR to extract plain text and structured information from images and documents.
  • Detect and localize objects and faces in images, and choose between general-purpose and custom models.
  • Apply basic image-enhancement operations to improve data quality for models or improve user-facing images.
  • Integrate Azure image-processing APIs into applications and select appropriate service endpoints and SDKs for your scenario.

Recommended prerequisites: familiarity with basic programming (Python, C#, or JavaScript), basic concepts of machine learning, and access to an Azure subscription to experiment with Cognitive Services.

Module structure and flow

  1. Image representation & preprocessing
    • Pixel formats, color spaces (RGB, BGR, grayscale), and when to convert.
    • Resizing strategies (preserve aspect ratio, padding vs. cropping).
    • Normalization and mean/std scaling for ML models.
    • Basic filters: Gaussian blur, median filter, unsharp masking, Sobel/Laplacian edge detection.
  2. Optical Character Recognition (OCR)
    • When to use generic Read/OCR APIs vs. Form Recognizer for structured forms.
    • Preprocessing tips to improve OCR accuracy: deskewing, denoising, binarization, and contrast adjustment.
    • Extracting and post-processing text for downstream use.
  3. Object & face detection
    • Trade-offs between pre-trained models and Custom Vision (accuracy vs. training cost).
    • Face detection, face landmarks, and verification concepts with Face API.
    • Bounding box formats and coordinate conventions.
  4. Image enhancement & manipulation
    • Adjustments for brightness/contrast/sharpness and techniques for denoising.
    • Geometric transforms (rotate, scale, crop) and format conversion for web and model inputs.
  5. Integration & scaling
    • Calling REST APIs vs. using SDKs (Python/C#/JavaScript) and handling async operations for long-running tasks.
    • Batch processing patterns, streaming pipelines, and serverless integration options.

Quick reference: common preprocessing patterns

  • Resize while preserving aspect ratio:
    • Compute scale factor and resize the longer side to a target, then pad/crop.
  • Normalize pixel values:
    • Scale to [0, 1] or standardize using mean/std depending on the model.
  • Convert color spaces:
    • Many OpenCV functions use BGR; convert to RGB when using most ML frameworks.
  • Remove noise:
    • Use median blur for salt-and-pepper noise, Gaussian blur for general smoothing.
  • Edge detection:
    • Apply Sobel or Canny to extract edges for tasks like contour detection.
Example: Python (OpenCV + NumPy) snippet for common preprocessing steps
JavaScript (Node.js + sharp) — resizing and conversion
C# (System.Drawing/Core or ImageSharp) — basic resizing

Choosing the right Azure service

Useful links:

Integration patterns and recommendations

  • For small-scale or prototyping projects, use the SDK for your language (Python/C#/JavaScript) for convenience.
  • For high-throughput pipelines, call REST APIs directly from distributed workers or serverless functions; use batch transforms and message queues.
  • For document-heavy solutions, combine Form Recognizer with pre- and post-processing steps to normalize and validate extracted fields.
  • For improving OCR or detection accuracy, apply preprocessing (deskew, enhance contrast, denoise) before sending images to the service.
Example pattern: asynchronous Read API workflow
  1. Upload image or provide URL to the Read API.
  2. Receive an operation/location URL with an operation ID.
  3. Poll the operation endpoint until the status is succeeded.
  4. Retrieve structured results and map to your data model.

  • Start with image preprocessing exercises: resize, normalize, and apply filters using your preferred language.
  • Run a sample OCR extraction using the Read API and compare results with and without preprocessing.
  • Try an object detection task with Custom Vision on a small labeled dataset.
  • Build a simple pipeline that ingests images, preprocesses them, calls an Azure vision service, and stores results.

References and further reading Now let’s proceed to the first lesson: image preprocessing and basic filters.

Watch Video