Digital Image Fundamentals and Computer Vision Notes

Overview of Computer Vision and Digital Image Processing

  • Key Definitions:

    • Image Function: Represented mathematically as a two-dimensional function f(x,y)f(x, y), where xx and yy denote spatial (plane) coordinates.

    • Intensity / Gray Level: The amplitude or value of the function ff evaluated at any specific spatial coordinate pair (x,y)(x, y).

    • Digital Image: Formed when the spatial coordinates x,yx, y and the amplitude/intensity values of ff are all finite, discrete quantities.

    • Digital Image Processing: The domain involving the computational processing and manipulation of digital images using digital computers.

    • Pixel (Picture Element / Image Element / Pel): The fundamental discrete element comprising a digital image, possessing a specific spatial position and scalar intensity value.

  • Spectrum of Computerized Visual Processing:

    • Computer Vision: A subfield of Artificial Intelligence (AI\text{AI}) whose overarching objective is to emulate human visual perception, learning, inference, and action execution from visual inputs.

    • Continuum Boundaries: No strict boundary exists between digital image processing at one extreme and computer vision at the other, but processes are generally categorized into three computational levels:

    • Low-Level Processes: Take an image as input and produce an image as output. Encompass primitive operations such as noise reduction, contrast enhancement, and image sharpening.

    • Mid-Level Processes: Take an image as input and yield extracted image attributes (such as edges, contours, or object identities) as output. Includes tasks like image segmentation, object description, and object classification/recognition.

    • High-Level Processes: Involve visual cognition, scene understanding, image analysis, and executing high-level decisions based on an ensemble of recognized objects.

Historical Context: Origins of Digital Image Processing

  • Early Telecommunication Milestones:

    • Bartlane Cable Picture Transmission System: Introduced in the early 1920s to transmit digital images across transatlantic submarine cables.

    • Transmission Efficiency: Reduced the total transport duration of a newspaper image across the Atlantic Ocean from over one week to under three hours.

    • System Mechanics: Encoded image data onto paper tapes at the transmitting terminal and reconstructed images at the receiving terminal using telegraph printers equipped with specialized typefaces.

A digital picture produced in 1921 from a coded tape by a telegraph printer with special type faces.

Fundamental Steps in Digital Image Processing

  • Process Classification & Architecture:

    • Image Output Stages: Image Acquisition, Image Enhancement, Image Restoration, Color Image Processing, Wavelets and Multiresolution Processing, Compression, and Morphological Processing.

    • Attribute Output Stages: Segmentation, Representation and Description, and Object Recognition.

    • Knowledge Base: A centralized database containing problem-domain information that interacts continuously across all processing stages.

Fundamental Steps in Digital Image Processing
  • Detailed Functional Breakdown:

    • Image Acquisition:

    • The initial stage in any image processing pipeline.

    • Involves converting a physical scene into a digital image, which may include spatial scaling and preprocessing.

    • Can be as simple as receiving an existing image file in digital format.

    • Image Enhancement:

    • A subjective processing discipline focused on highlighting specific features of interest or unmasking hidden detail.

    • Example: Increasing contrast to make an image more visually useful or aesthetically appealing.

    • Image Restoration:

    • An objective processing discipline focused on reversing image degradation.

    • Relies on explicit mathematical or probabilistic models of degradation mechanisms, contrasting with subjective enhancement.

    • Color Image Processing:

    • Focuses on techniques for handling full-color digital images and multi-spectral imagery.

    • Crucial due to the rapid proliferation of color digital graphics across global networks.

    • Wavelets and Multiresolution Processing:

    • Provides a mathematical framework for representing images at varying degrees of spatial resolution.

    • Images are recursively decomposed into smaller spatial frequency sub-bands.

    • Compression:

    • Focuses on reducing data redundancy to decrease storage requirements and transmission bandwidth.

    • Utilizes standards such as the Joint Photographic Experts Group (JPEG\text{JPEG}), commonly denoted by the .jpg.jpg file extension.

    • Morphological Processing:

    • Provides mathematical tools for extracting structural image components useful in shape representation and description.

    • Segmentation:

    • Partitions an input image into its constituent regions, structures, or individual objects.

    • Autonomous segmentation is one of the most challenging tasks in image processing.

    • Robust segmentation algorithms are necessary for successful high-level visual analysis; weak algorithms lead to failure.

    • Representation and Description:

    • Follows the segmentation stage, taking raw pixel data representing boundaries or regions.

    • Boundary Representation: Used when the focus is on external shape features (such as corners and inflection points).

    • Regional Representation: Used when the focus is on internal attributes (such as texture or skeletal topology).

    • Description: Computes specific feature descriptors from representation data to differentiate objects.

    • Object Recognition:

    • Assigns specific symbolic labels (such as vehicle, cell, or letter) to objects based on computed descriptors.

    • Knowledge Base:

    • Encodes domain-specific information, directing algorithm execution and guiding interactions between processing stages.

Components of a General-Purpose Image Processing System

  • Hardware and Software Architecture:

    • Systems integrate sensing, hardware acceleration, general processing, mass storage, displays, hardcopy units, and networking.

Components of a general-purpose image processing system.
  • Functional Subsystem Specifications:

    • Image Sensors:

    • Requires a physical sensing device sensitive to emitted or reflected physical energy (such as light).

    • Requires a digitizer to convert continuous physical voltage waveforms into digital values.

    • Specialized Image Processing Hardware:

    • Hardware modules designed for high-throughput processing, such as Digitizers and Arithmetic Logic Units (ALU\text{ALU}).

    • Operates as a front-end subsystem to perform fast parallel operations across entire image matrices.

    • Performs real-time tasks like frame-averaging at video rates (30 frames/s30\,\text{frames/s}) to eliminate noise.

    • Main Computer:

    • General-purpose computer system ranging from standard personal computers (PC\text{PC}) to high-performance supercomputers.

    • Image Processing Software:

    • Specialized software libraries consisting of dedicated image manipulation modules.

    • Allows integration of custom user scripts and high-level programming language routines.

    • Mass Storage Subsystems:

    • Essential due to high memory demands; an uncompressed 1024×10241024 \times 1024 pixel image with 8-bit8\text{-bit} intensity values requires 1 MB1\,\text{MB} (106 bytes10^6\,\text{bytes}) of storage.

    • Short-Term Storage: High-speed system memory and dedicated frame buffers capable of rapid refresh at video rates (30 images/s30\,\text{images/s}).

    • Online Storage: Fast-recall magnetic disks and optical media.

    • Archival Storage: Massive capacity storage with lower access speeds, such as magnetic tapes and automated optical jukeboxes.

    • Standard Storage Metrics: Bytes (8 bits8\,\text{bits}), Kilobytes (KB=103 bytes\text{KB} = 10^3\,\text{bytes}), Megabytes (MB=106 bytes\text{MB} = 10^6\,\text{bytes}), Gigabytes (GB=109 bytes\text{GB} = 10^9\,\text{bytes}), and Terabytes (TB=1012 bytes\text{TB} = 10^{12}\,\text{bytes}).

    • Hardcopy Output Devices:

    • Film cameras, laser printers, heat-sensitive devices, inkjet printers, and digital storage media.

    • Film provides the highest achievable spatial resolution, whereas paper is standard for printed documents.

    • Networking Infrastructure:

    • Handles image data transfer across remote computational nodes, where network bandwidth represents the primary operational constraint.

Image Sampling and Quantization

  • Mathematical Principles of Discretization:

    • Physical sensors capture continuous real-world phenomena as continuous voltage waveforms.

    • To create a digital image, continuous spatial coordinates and continuous amplitude values must both be digitized.

    • Spatial Coordinate Discretization: Termed sampling.

    • Intensity Amplitude Discretization: Termed quantization.

Generating a digital image showing sampling and quantization.
  • Step-by-Step Digitization along a Scanline:

    • A continuous 1D intensity profile taken along line segment ABAB contains minor fluctuations due to sensor noise.

    • Spatial sampling selects discrete, equally spaced spatial locations along line ABAB, indicated by vertical tick marks.

    • Amplitude quantization divides the continuous intensity scale into discrete levels (such as 88 distinct levels from black to white).

    • Each spatial sample is assigned the closest discrete intensity level on the scale to yield a digital scanline profile.

Continuous image projected onto a sensor array and the resulting sampled/quantized image.

Digital Image Representation

  • Matrix Representation of Digital Images:

    • Sampling and quantization map a continuous image f(x,y)f(x, y) into an M×NM \times N numerical matrix.

    • Discrete spatial coordinate system: Origin (x,y)=(0,0)(x, y) = (0, 0) is located at the top-left corner.

    • Axis Orientation: Row index xx extends vertically downward from 00 to M−1M-1; column index yy extends horizontally rightward from 00 to N-1$.\n\n![Coordinate convention used to represent digital images.](https://assets.knowt.com/pdf-flow-prod/9a50bd56-d181-44fe-ab66-1f7394c38bb8-figures/19.png)\n\n* Matrix Formulations:\n * Continuous sampling representation:\n    f(x, y) = \begin{bmatrix} f(0,0) & f(0,1) & \cdots & f(0, N-1) \ f(1,0) & f(1,1) & \cdots & f(1, N-1) \ \vdots & \vdots & \ddots & \vdots \ f(M-1,0) & f(M-1,1) & \cdots & f(M-1, N-1) \end{bmatrix}\n * Traditional matrix notation:\n    \mathbf{A} = \begin{bmatrix} a_{0,0} & a_{0,1} & \cdots & a_{0,N-1} \ a_{1,0} & a_{1,1} & \cdots & a_{1,N-1} \ \vdots & \vdots & \ddots & \vdots \ a_{M-1,0} & a_{M-1,1} & \cdots & a_{M-1,N-1} \end{bmatrix}\n\n* Intensity Quantization and Memory Footprint Calculations:\n * Discrete intensity levels Laretypicallyrestrictedtointegerpowersofare typically restricted to integer powers of2 due to hardware constraints:\n    L = 2^k\n * Intensity values are equally spaced integers in the closed range [0, L-1].\n * Dynamic Range: The range of intensity values present in an image. Images spanning a high dynamic range exhibit high contrast, whereas low dynamic range images appear dull and washed out.\n * Required Memory Capacity b (in bits):\n    b = M \times N \times k\n * For square digital images where M = N:\n    b = N^2 \times k\n\n* Exact Memory Capacity Values for Square Images (N \times N):\n * N = 32, k = 1\,(L = 2) \implies 1,024\,\text{bits}\n * N = 32, k = 8\,(L = 256) \implies 8,192\,\text{bits}\n * N = 64, k = 8\,(L = 256) \implies 32,768\,\text{bits}\n * N = 128, k = 8\,(L = 256) \implies 131,072\,\text{bits}\n * N = 256, k = 8\,(L = 256) \implies 524,288\,\text{bits}\n * N = 512, k = 8\,(L = 256) \implies 2,097,152\,\text{bits}\n * N = 1024, k = 8\,(L = 256) \implies 8,388,608\,\text{bits}\n * N = 2048, k = 8\,(L = 256) \implies 33,554,432\,\text{bits}\n * N = 4096, k = 8\,(L = 256) \implies 134,217,728\,\text{bits}\n * N = 8192, k = 8\,(L = 256) \implies 536,870,912\,\text{bits}\n\n# Spatial and Gray-Level Resolution\n\n* Core Definitions:\n * Spatial Resolution: The smallest discernible spatial detail in an image, governed primarily by spatial sampling frequency. Quantified as discernible line pairs per unit distance (e.g., 100\,\text{line pairs/mm}).\n * Gray-Level Resolution: The smallest discernible variation in intensity levels within an image.\n\n* Sampling Operations:\n * Subsampling: Reduces image dimensions by deleting rows and columns from the pixel array.\n * Resampling: Enlarges smaller images to original dimensions via row and column duplication.\n\n![Image subsampling from 1024x1024 down to 32x32 pixels.](https://assets.knowt.com/pdf-flow-prod/9a50bd56-d181-44fe-ab66-1f7394c38bb8-figures/23.jpg)\n\n* Zooming and Shrinking:\n * Zooming (Oversampling): Requires creating a high-density grid and assigning intensity values to new pixel locations.\n * Shrinking (Undersampling): Collapses an existing grid into fewer spatial samples.\n * Interpolation Techniques:\n * Nearest Neighbor Interpolation: Assigns the intensity of the nearest pixel in the original image. Computationally simple, but produces visible blockiness.\n * Bilinear Interpolation: Interpolates intensity using the four closest neighbors, producing smoother transitions.\n\n![Nearest neighbor versus bilinear interpolation zooming.](https://assets.knowt.com/pdf-flow-prod/9a50bd56-d181-44fe-ab66-1f7394c38bb8-figures/25.jpg)\n\n# Basic Relationships Between Pixels\n\n* Pixel Neighborhoods:\n * For a central pixel patspatialcoordinatesat spatial coordinates(x, y):\n * 4\text{-Neighbors } N_4(p): The four orthogonally adjacent pixels:\n    N_4(p) = {(x+1, y), (x-1, y), (x, y+1), (x, y-1)}\n * Diagonal Neighbors N_D(p): The four diagonally adjacent pixels:\n    N_D(p) = {(x+1, y+1), (x+1, y-1), (x-1, y+1), (x-1, y-1)}\n * 8\text{-Neighbors } N_8(p): Union of orthogonal and diagonal neighbors:\n    N_8(p) = N_4(p) \cup N_D(p)\n\n* Pixel Adjacency Types:\n * Let Vbethesetofintensityvaluesusedtodefineadjacency(e.g.,be the set of intensity values used to define adjacency (e.g.,V = {1}forbinaryimages,oradesignatedsubsetoffor binary images, or a designated subset of[0, 255] for grayscale images).\n * 4\text{-Adjacency}:Pixels: Pixelspandandqwithvaluesfromwith values fromVareare4\text{-adjacent}ififq \in N_4(p).\n * 8\text{-Adjacency}:Pixels: Pixelspandandqwithvaluesfromwith values fromVareare8\text{-adjacent}ififq \in N_8(p).\n * m\text{-Adjacency (Mixed Adjacency)}:Pixels: Pixelspandandqwithvaluesfromwith values fromVarearem\text{-adjacent} if:\n 1. q \in N_4(p), OR\n 2. q \in N_D(p)ANDtheintersectionsetAND the intersection setN_4(p) \cap N_4(q)containsnopixelswithintensityvaluesfromcontains no pixels with intensity values fromV$.

    • Purpose of m-Adjacencym\text{-Adjacency}: Modifies 8-adjacency8\text{-adjacency} to eliminate ambiguous, multiple path connections.

Arrangement of pixels, 8-adjacency, and m-adjacency.
  • Paths, Connectivity, Regions, and Boundaries:

    • Digital Path: A sequence of distinct pixels (x0,y0),(x1,y1),…,(xn,yn)(x_0, y_0), (x_1, y_1), \dots, (x_n, y_n) where (x0,y0)=(x,y)(x_0, y_0) = (x, y), (xn,yn)=(s,t)(x_n, y_n) = (s, t), and (xi,yi)(x_i, y_i) is adjacent to (xi−1,yi−1)(x_{i-1}, y_{i-1}) for 1 \le i \le n$.\n * Path Length: Total number of steps n along the sequence.\n * Closed Path: A path where (x_0, y_0) = (x_n, y_n).\n * Connectivity: Pixels pandandqareconnectedinapixelsubsetare connected in a pixel subsetSifapathexistsbetweenthemcomposedentirelyofpixelsinif a path exists between them composed entirely of pixels inS$.

    • Connected Component: The set of all pixels in SS connected to a given pixel pp

    • Connected Set: A subset SS that consists of a single connected component.

    • Region RR: A subset of pixels in an image that forms a connected set.

    • Boundary (Border / Contour): The set of pixels in region RR that have at least one neighbor not in RR. If RR is the entire image, its boundary consists of the first and last rows and columns.

Pixel Distance Metrics

  • Axiomatic Metric Definition:

    • A distance function DD between pixels p(x,y)p(x, y), q(s,t)q(s, t), and z(v,w)z(v, w) is a valid metric if it satisfies:

    1. Non-negativity and Identity: D(p,q)≥0D(p, q) \ge 0, and D(p,q)=0  ⟺  p=qD(p, q) = 0 \iff p = q

    2. Symmetry: D(p,q)=D(q,p)D(p, q) = D(q, p)

    3. Triangle Inequality: D(p,z)≤D(p,q)+D(q,z)D(p, z) \le D(p, q) + D(q, z)

  • Metric Equations and Geometric Forms:

    • Euclidean Distance De(p,q)D_e(p, q):     De(p,q)=(x−s)2+(y−t)2D_e(p, q) = \sqrt{(x - s)^2 + (y - t)^2}     Pixels satisfying De(p,q)≤rD_e(p, q) \le r form a circular disk of radius rr centered at (x,y)(x, y).

    • City-Block Distance D4(p,q)D_4(p, q):     D4(p,q)=∣x−s∣+∣y−t∣D_4(p, q) = |x - s| + |y - t|     Pixels satisfying D4(p,q)≤rD_4(p, q) \le r form a diamond centered at (x,y)(x, y).     Contour of constant D4D_4 distance values centered at (x,y)(x, y) with D4=0D_4 = 0: 2 2 1 2 2 1 0 1 2 2 1 2 2     

    • D4=0→D_4 = 0 \rightarrow center pixel (x,y)(x, y)

    • D4=1→D_4 = 1 \rightarrow 4-neighbors directly adjacent to the center

    • D4=2→D_4 = 2 \rightarrow pixels two steps away via horizontal and vertical movements

    • Chessboard Distance D8(p,q)D_8(p, q):     D8(p,q)=max⁡(∣x−s∣,∣y−t∣)D_8(p, q) = \max(|x - s|, |y - t|)     Pixels satisfying D8(p,q)≤rD_8(p, q) \le r form a square centered at (x,y)(x, y).     Contour of constant D8D_8 distance values centered at (x,y)(x, y) with D8≤2D_8 \le 2: 2 2 2 2 2 2 1 1 1 2 2 1 0 1 2 2 1 1 1 2 2 2 2 2 2     

    • D8=1→D_8 = 1 \rightarrow 8-neighbors of (x,y)(x, y).