============================ Lec 1 ==============================
- Computer imaging = It’s defined as the acquisition and processing of visual
information by computer.
• Image Processing: image in → image out
• Image Analysis: image in → measurements out
• Image Understanding: image in → high-level description out
- A digital image is a representation of a two-dimensional image as a finite set of
digital values, called picture elements or pixels.
- A digital image is NOT the real scene → it is an approximation of it.
- Common Digital Image Formats:
• 1 sample per pixel → Grayscale image (Only intensity / gray level)
• 3 samples per pixel → Color image (RGB) (Red, Green, Blue components)
Digital Image Processing (DIP) focuses on:
• Improving images so humans can see them better.
• Preparing image data so machines can store, transmit, or understand it.
- This forms a continuum, divided into Three levels:
1. Low-Level Processing(Enhance or improve)
- Input: Image
- Output: Image
2. Mid-Level Processing(Extract useful information)
• Input: Image
• Output: Attributes
3. High-Level Processing(Interpret the scene)
• Input: Attributes
• Output: Understanding
- Image = A two-dimensional function f(x, y), f(x, y) → intensity (gray level) at that
point
• The amplitude of f is called intensity or gray level at the point (x, y)
- Image enhancement/restoration: One of the most common uses of DIP
techniques: improve quality, remove noise.
Key Stages in Digital Image Processing:
Problem Domain → Acquisition → Enhancement→ Restoration →
Morphological Processing → Segmentation → Object Recognition →
Understand → Representation & Description.
• Restoration: Fix a degraded image using a known or estimated model of
distortion.
• Morphological Processing: Extract structure or shape information. Helps with
identifying boundaries, skeletons, convex hulls.
• Segmentation: subdivides an image into its constituent.
• Image compression: reducing the massive amount of data needed to represent
an image.
- The EM spectrum is the most important and widely used source of images,
covering gamma rays, X-rays, UV, visible light, infrared, microwaves, and radio
waves
============================ Lec 2 ==============================
The human visual system : is the best vision model for understanding how images
are formed and processed in the eye.
• Light passes through the lens, which focuses it onto the retina.
• Retina = sensors of light.
The retina is covered with light
The retina contains two types of light receptors: receptors called cones and rods.
- Cones are (6-7 million) concentrated at the central
• Cones → color, high detail
portion of the retina and high sensetive to color.
• Rods → low light, night vision
- Rods are (75-150 million) distributed at retina surface
and are sensitive to low levels of illumination.
- The retina has photoreceptors (sensors) that detect light intensity. These signals
are then converted into digital images for processing.
- Sensors detect light intensity (photons striking them)
Three main arrangements:
• Single sensor → one pixel at a time
• Line sensor → scans line by line
• Array sensor → 2D grid of pixels
- simultaneous contrast: Is related to the fact that a region’s perceived
brightness does not depend on its intensity.
- Optical Illusions: In which the eye fills in nonexisting information or wrongly
perceives geometrical properties of objects.
- Continuous image(in real life) to digital(Computer):
Analog image --> Sampling --> Quantization --> Digital image
• Image Sampling → digitize the coordinates of the image
• Image Quantization → digitize the intensity (amplitude) of the image
• Image Representation: Convert the input image into a form suitable for
computer processing.
• Dynamic Range: Ratio of maximum intensity to minimum detectable intensity in
an image.
• Image Contrast: Difference between highest and lowest intensity levels in an
image.
• Intensity resolution: defines how small a change in intensity can be detected in
an image.
Set and logical operations (Slide 38)
Spatial operations are performed directly on the pixels of an image. They are
classified into three types depending on the area of influence:
• Point operations → depend only on the pixel itself.
• Local operations → depend on neighboring pixels.
• Global operations → depend on all pixels in the image.
============================ Lec 3 ==============================
Image Interpolation = Is the process of using known data to estimate values at
unknown location.
• Used for: zooming, shrinking, rotating, geometric corrections
• Zooming & shrinking → image resizing / re-sampling
Zooming (Over-Sampling):
Techniques for zooming:
• Nearest Neighbor interpolation → assign value of closest original pixel
• Bilinear interpolation→ weighted average of 4 nearest pixels
• Bicubic interpolation → weighted average of 16 nearest pixels
Nearest Neighbor interpolation Example....(Slide 8, 9, 10)
Pixel replication is a resampling method used when increasing the image size by
an integer factor (e.g., 2×, 3×).
Example(Slide 11)
Shrinking: reducing the size of an image, similar to zooming but in reverse.
- Bilinear Interpolation is a zooming/resampling method where the gray level of a
new pixel is estimated using the 4 nearest neighboring pixels.
- Bicubic Interpolation is a zooming/resampling method where the gray level (or
color) of a new pixel is computed from a weighted average of the 16 nearest
neighboring pixels.
Adjacent pixels: pixels that are neighbors and have gray values from the same set
V.
• V = subset of gray levels in the image
• There are three types of adjacency: 4-adjacency, 8-adjacency, M-adjacency
OPEN slides (24 --> 32)
Connectivity
• S = subset of pixels in an image
• Connectivity: Two pixels p and q are connected in S if there is a path of pixels
entirely in S joining them.
• Connected Component: All pixels in S connected to a given pixel p.
• Connected Set: S has only one connected component.
Examples on Connectivity (Slide 33, 34, 35, 36)
============================ Lec 4 ==============================
Regions and Boundaries
• R = subset of pixels in an image
• Region: a connected set of pixels with similar properties
• R is a region of the image if R is a connected set.
• Boundary of a region: pixels in R that have at least one neighbor NOT in R
• Boundary of a region usually forms a closed path around the region.
• Inner boundary = pixels inside the region (interior wall)
• Outer boundary = pixels outside the region (exterior wall, part of the
background)
Distance Meahsures (Slides 8 - 15)
Image Enhancement: processing an image to make it more suitable for a specific
application. (Better contrast and more details)
Enhancement techniques improve images and are classified into two types:
• Spatial Domain → manipulate pixels directly in the image plane.
• Frequency Domain → modify the frequency spectrum of the image.
Spatial Domain : aggregate of pixels composing an image.
• Spatial Domain processes: g (x, y) = T [ f (x, y)]
• g (x, y) --> Processed (output) image
• T --> operator defined on some neighborhood of f(x, y)
• f (x, y) --> Input image
Types of neighborhood : (Slide 19)
1. Intensity transformation: neighborhood of size 1X1.
2. Spatial filter(or mask, kernel, template or window): neghborhood of larger size.
Intensity Transformation Functions
• here, T is called intensity transformation funtion of (mapping, gray level
function) g(x, y) = T[f(x, y)].
Intensity Transformation Functions fall into approaches:
1) basic intensity transformation
a) Linear
b) Logarithmic
c) Power
2) Piecewise Linear transformation functions
a) Constrant strething, thresholding
b) Gray-level slicing
c) Bit-plane slicing
Negative Transformation Function
Purpose: Enhances white or gray details in dark/black regions of an image.
Formula: S=(L−1)−r
Log Transformation
Purpose: Enhances dark pixels in an image by mapping a narrow range of low
input gray levels to a wider range of output values → makes dark images brighter.
Formula: s = c * log(1+r), r ≥ 0
Exponential or Inverse-Log Transformation
The general form is : s = T(r) = c(b^r - 1)
============================ Lec 5 ==============================
Which mean that the bright pixels in
Contrast Stretching ("Normalization") the image will become brighter and the
dark pixels will become darker, this
Purpose: means: higher contrast image
• Enhances low-contrast images by stretching the range of pixel intensities.
• Improves image quality and visibility of details.
- Contrast: Difference between maximum and minimum pixel intensity in an
image.
Causes of Low Contrast:
• Poor illumination
• Limited dynamic range of the imaging sensor
• Wrong setting of lens
- The idea behined contrast stretching is to increase the dynamic range of the
gray levels in the image being processed.
Thresholding
Purpose:
• Converts pixels with dark intensities into black and bright pixels into
white(binary image (black & white)) based on a threshold value
How It Works:
• Choose a threshold value T.
For each pixel r:
• If r≥T → set output s=1 (white)
• If r<T → set output s=0 (black)
Exercise on Contrast Stretching and Thresholding(Slide 24, 25)
============================ Lec 6 ==============================
Histogram: A gragh indicating the number of times each gray level occurs in the
image. I.e. frequency of the brithness value in the image.
Four types of images and their histogram(slides 3, 4, 5):
1. Dark Image: histogram are Low side of the gray level
2. Bright image: histogram are High side of the gray level
3. Low-contrast image: histogram is narrow and centered toward the middle of
the gray scale
4. High-contrast: histogram covers broad range of the gray scale and the
distribution of pixels is not too far from uniform, with very few vertical lines being
much higher than the others.
- Histogram of digital image: h(rk) = nk
- Histogram data is useful in many applications like image compression and
segmentaion.
Histogram Equalization: is an image processing technique used to improve
contrast in images.
- It accomplishes this by effectivly spreading out the most frequent intensity
values, i.e. streching out the intensity range of the image.
Histogram Equalization: is the process for adjusting image intensities to enhanec
contrast.
- Im matlab: we use histeq function.
Equalization (mathematically):
g(x) = [(T(x) / n) * L] - 1.
g(x) = (L / n) * T(x) - 1.
- g(x): The new image after equalixation
- n: No of pixels
- L: No of the gray level 2k (k --> 3-bit image, k = 3)
- T(x): cumulative sum of each gray level.
EXAMPLE --> Slide 15, 16, 17
Intensity Level Slicing(gray level slicing):
- Highlighing a specific range of intensities in an image.
- Segmant certine gray level regions from the rest of the image
Intensity Level Slicing Approch 1(First approach): Display the desired range of
intensities in white and suppress all other intensities to black of vice verse.
Intensity Level Slicing Approch 2(Second approach): We brighten or darken the
desired range of intensities and leave other intensities unchanged or vice versa.
EXAMPLE (Slide 27)
Bit-Plane Slicing: Remember that pixels are digital numbers composed of 8 bits.
instead of highlighting gray-level range, we could highlight the contribution
made by each bit.
EXAMPLE (Slide 33)
Enhancement using:
1. Arithmetic operation:
- Sbtraction, Addition ==> Most useful in image inhancement
- Multiplication ==> used as masking operation
- Division
2. Logical operations:
- AND, OR ==> used for masking
- NOT
- Frequenc used in conjunction with morphological operations
- Subtraction of two images is often used to detect motion.
- Logical operations for Masking (Slide 39)
============================ Lec 7 ==============================
Sharpening Spatial Filters: the principle objective of charpning is to highlight
transition in intesity
- is accoplished by spatial differentiation.
- image differentiation enhance edges and other disconinuities(such as noise)
and deemphasizes areas with slowly varying gray-level values.
EXAMPLE on sharping(Slide 3).
EXAMPLE on Second derivative(Slide 6)
Spatial filtes: Sharping(high pass):
1. Laplace
2. Unsharp
3. High boost
4. Sobel
The Laplacian(Better implementation):
Used for image enhancement in a better way by increasing(decreasing) the
center coefficient by 1.
EXAMPLE on Laplacian and composite Laplican filters(SLide 1 5to 28)
EXAMPLE (Slide 29)
============================ Lec 8 ==============================
Sharpening Spatial Filters: Used for highlighting fie detail or enhancing detail that
has been blurred.
- Average is analogous to integration.
- Sharping is analogous to defferentiation
A basic defination of the first-order deivative of 1-D function f(x) is the difference:
f(x) = f(x + 1) - f(x).
- Second derivates:
f(x) = f(x + 1) + f(x - 1) + 2f(x).
Unsharp Masking:
- This operation is referred to as edge enhancement, edg crispening or unsharp
masking.
- To make edgs slightly sharper and crisper.
- Subtracting a blurred version of an image from the image itself: (Slide 7)
- To sharpen images by subtracting a blurred or unsharp(smoothed)version of an
image from the orginal image.
EXAMPLE (Slide 12)
We can applay soble horizontal kernel Gx of sobel vertical kernel Gy or both and
adding them together.
Example: Sobel operatores, Find the gradient Gx, Gy(Slide 21 to 25)
============================ Lec 9 ==============================
BASIC COMPRESSION ALGORITHMS
Data compression : is the science of representing data in a compact form
- A compression problem involves finding a efficient algorithm to remove
various redundancy from a certain type of data
Many questions related to data compression:
- Why do we compress
- What do we mean by source data
- How would we know if there is any redundancy in a source
Compression can be categorized in two broad ways:
1- Lossless Compression : after decompression gives an exact copy of the original
data.
Example : Entropy encoding schemes (Shannon Fano, Huffman coding),
arithmetic coding, LZW algorithm (used in GIF image format).
2- Lossy Compression: after decompression gives ideally a “close” approximation
of the original data, ideally perceptually lossless.
Example: Transform coding- FFT/DCT based quantization used
- Compression ratio of lossless methods (e.g., Huffman coding, arithmetic coding,
LZW) is not high enough for audio/video.
Lossless Compression Algorithms
- Repetitive Sequence Suppression.
Example: 89400000000000000000000000000000000
We can replace with: 894f32
Where f is the flag for zero.
- Run-Length Encoding(RLE).
Original sequence : 111122233333311112222
Can be encoded as: (1,4), (2,3), (3,6), (1,4), (2,4)
EXAMPLE (Slide 14)
- Pattern Substitution
Example: And you and I
Becomes : & you & I
- Entropy Encoding
- Shannon-Fano Algorithm.
- Huffman Coding
- Arithmetic Coding.
- Lempel-Ziv-Welch (LZW) Algorithm.