Digital Image Processing - Chapter 2 Summary
Chapter 2: Digital Image
Fundamentals
Digital Image Processing — Gonzalez & Woods (4th Edition)
This chapter teaches us the basics of how digital images work. Think of it like learning the
alphabet before reading a book. By the end of this chapter, you will know how your eyes see
things, what light is made of, how cameras take pictures, and how computers store and change
images. Let's explore each topic step by step!
Section 2.1: Elements of Visual Perception
This section helps us understand how our EYES and BRAIN see pictures. Before we learn how
computers handle images, we need to understand how humans see things.
How the Human Eye Works
Your eye is like a tiny camera inside your head! Here is what each part does:
• Cornea: The clear cover on the front of your eye, like the lens cap of a camera.
• Iris: The colored ring around your pupil. It gets bigger in the dark and smaller in bright
light to control how much light enters.
• Pupil: The black circle in the center. It is actually an opening that lets light in.
• Lens: Bends the light so it focuses correctly on the back of your eye.
• Retina: The back wall of the eye where the image lands, like the film in an old camera.
• Fovea: A tiny special area in the middle of the retina where you see the sharpest details.
• Blind spot: A small area where you cannot see anything because there are no
receptors there.
Two Types of Receptors: Rods and Cones
Inside the retina, there are millions of tiny sensors called rods and cones. Think of them like two
different types of workers in a factory:
• Cones (6 to 7 million): These work in bright light and help you see colors. There are
about 150,000 cones per square millimeter in the fovea. Each cone has its own nerve,
which is why you can see very fine detail.
• Rods (75 to 150 million): These work in dim light but cannot see color. Many rods share
one nerve, so they are better at seeing in the dark but not at seeing fine details.
Easy Summary for Young Learners | Page 1
Digital Image Processing - Chapter 2 Summary
Example: In moonlight, everything looks gray because only the rods are working,
not the cones!
How the Eye Forms an Image
Unlike a camera where the lens moves forward or backward to focus, the human eye changes
the SHAPE of its lens. Muscles called ciliary muscles squeeze or stretch the lens to focus on
near or far objects. The image on the retina is actually upside down, but your brain flips it right-
side up automatically!
Brightness Adaptation
Your eyes can adapt to very different light levels, from very dark to very bright. This is called
brightness adaptation. When you walk into a dark room from bright sunlight, your eyes take a
minute to adjust. The total range your eyes can handle is enormous (about 10 billion different
brightness levels!), but at any one moment, you can only see a much smaller range.
Weber's Ratio: How Well Can You Tell Two Brightnesses Apart?
Scientists measured how well people can tell two slightly different brightnesses apart. The result
is called the Weber Ratio. A small ratio means your eyes are very good at noticing small
changes in brightness. In dim light, you are not very good at this. But in normal daylight, you are
much better at spotting small differences.
Optical Illusions and Perception Tricks
Your brain sometimes tricks you! Two very interesting effects are:
• Mach Bands: When you look at stripes going from light to dark, you seem to see extra-
bright or extra-dark lines at the edges. These are not actually there; your brain adds
them.
• Simultaneous Contrast: A gray box on a dark background looks lighter than the exact
same gray box on a bright background. Your brain compares the gray to what is around
it.
These effects show us that what we see is NOT always exactly what is really there!
Section 2.2: Light and the Electromagnetic Spectrum
In this section, we learn what light actually is and how it connects to all the other kinds of
invisible waves around us.
What is the Electromagnetic Spectrum?
Easy Summary for Young Learners | Page 2
Digital Image Processing - Chapter 2 Summary
In 1666, Sir Isaac Newton showed that sunlight is actually made up of all the colors of the
rainbow. Visible light is just a tiny part of a huge family of energy waves called the
Electromagnetic (EM) Spectrum.
Think of the EM spectrum like a very long number line:
• Radio waves: Very long waves, used for radio and TV signals.
• Microwaves: Used in microwave ovens and radar.
• Infrared: Heat waves; used in remote controls and night-vision cameras.
• Visible light: The only part we can see with our eyes! Goes from violet to red.
• Ultraviolet (UV): What causes sunburns; can kill bacteria.
• X-rays: Can pass through soft body tissue; used in hospitals.
• Gamma rays: Very powerful and high energy; emitted by radioactive materials.
Key fact: The visible spectrum goes from about 0.43 micrometers (violet) to 0.79
micrometers (red). All other types of light are invisible to human eyes!
Wavelength, Frequency, and Energy
Every wave in the EM spectrum has three related properties:
• Wavelength: How long one wave is from tip to tip. Shorter wavelength = more energy.
• Frequency: How many waves pass a point per second. Measured in Hertz (Hz).
• Energy: Each tiny bundle of energy in a wave is called a photon. Gamma rays have the
most energy per photon; radio waves have the least.
The formula connecting wavelength and frequency is: wavelength = speed of light / frequency.
This means as frequency goes up, wavelength goes down.
Colors We See
The colors in visible light are: Violet, Blue, Green, Yellow, Orange, and Red. An object looks
green if it reflects mostly green wavelengths and absorbs the rest. An object looks white if it
reflects all colors equally. An object looks black if it absorbs almost all colors.
Types of Light
• Monochromatic (achromatic) light: No color, just shades from black to white. Also
called grayscale.
• Chromatic light: Has color. Described using three properties: Radiance (total energy),
Luminance (how bright it appears to the eye), and Brightness (how bright you think it
looks, which is subjective and impossible to measure exactly).
Section 2.3: Image Sensing and Acquisition
Easy Summary for Young Learners | Page 3
Digital Image Processing - Chapter 2 Summary
This section explains how cameras and sensors actually capture images. How do you take a
picture? First, you need a light source, then something to sense the light, and finally a way to
convert it to a digital image.
Three Types of Image Sensors
1. Single Sensing Element
Like a single tiny light detector. To get a full picture, you have to move the sensor across the
whole scene very slowly, row by row. This is very accurate but also very slow. Old high-
precision scanners work this way.
2. Sensor Strip (Line Sensor)
This is a row of many sensors arranged in a line. The line captures one row of the image at a
time. As it moves, it builds up the complete image. Flatbed scanners on your computer use this
method. CAT scan machines in hospitals use a ring of sensors to take slice-by-slice images of
the body.
3. Sensor Array (2D Array)
This is a big grid of sensors, like a tiny mosaic of light detectors. It captures the entire image at
once, instantly! This is exactly what your phone's camera uses. The sensors are CCD (Charge-
Coupled Device) or CMOS chips that can have millions of tiny elements.
A Simple Model of Image Formation
Every image is formed by two things working together:
• Illumination (i(x,y)): How much light hits the object. Example: bright sunlight or dim room
light.
• Reflectance (r(x,y)): How much of that light the object bounces back toward the camera.
A perfect mirror reflects 100%. Black velvet reflects only about 1%.
The image at any point = illumination x reflectance. This is why the same object looks different
in bright sunlight vs. dim shade.
Example: Snow reflects about 93% of light. Black velvet reflects only 1%. That is
why snow looks white and velvet looks nearly black.
Section 2.4: Image Sampling and Quantization
This section is about how we turn a real-world, continuous image (like what your eyes see) into
a digital image that a computer can store and use.
Two Steps to Make a Digital Image
Step 1: Sampling (Digitizing the Location)
Easy Summary for Young Learners | Page 4
Digital Image Processing - Chapter 2 Summary
A real image is smooth and continuous, with no gaps. To put it on a computer, we take a finite
number of samples. Imagine placing a grid over the image and measuring the brightness at
each grid point. Each grid point becomes one pixel. More grid points = better quality, but bigger
file size.
Step 2: Quantization (Digitizing the Brightness)
At each sample point, the brightness is a real number. Computers can only store whole
numbers, so we round each brightness to the nearest level. If we use 8 levels, we round to 0, 1,
2, 3, 4, 5, 6, or 7. If we use 256 levels, we get much smoother-looking images. Too few levels
cause a messy effect called FALSE CONTOURING, which looks like incorrect topographic
maps drawn on the image.
Representing a Digital Image
A digital image is stored as a grid (matrix) of numbers. Each number is a pixel value. The grid
has M rows and N columns. The top-left corner is coordinates (0,0). The bottom-right is (M-1, N-
1). The total number of pixels = M x N.
Three ways to represent an image:
• As a 3D surface: x and y are location, z is brightness.
• As a visual picture: what you see on a screen.
• As a matrix of numbers: what the computer actually stores.
k-bit Images and Storage
The number of intensity levels is usually a power of 2. If we use k bits per pixel, then L = 2^k
levels are possible. Common examples:
• 1-bit image: 2 levels (just black and white, like a fax machine).
• 8-bit image: 256 levels (smooth grayscale, most common).
• 16-bit image: 65,536 levels (used in medical imaging for extra precision).
Total storage needed (in bits) = number of pixels x bits per pixel. A 1000x1000 pixel, 8-bit image
needs 8,000,000 bits = 1 megabyte (approximately).
Spatial Resolution and Intensity Resolution
Spatial resolution is about how much detail you can see. It is measured in dots per inch (dpi) or
line pairs per mm. Higher dpi = more detail. Newspapers use about 75 dpi. This book page was
printed at 2400 dpi.
Intensity resolution is about how many different shades of gray (or color) you can represent.
More bits = more shades = smoother look.
Think of it like this: Spatial resolution is how many tiny squares are in your
image. Intensity resolution is how many different colors/shades each tiny square
can be.
Easy Summary for Young Learners | Page 5
Digital Image Processing - Chapter 2 Summary
Isopreference Curves
Scientists did experiments asking people which images looked best at different combinations of
spatial resolution and number of intensity levels. They found that images with lots of detail (like
a crowd) need more spatial samples but fewer intensity levels to look good. Simple images (like
a face) need more intensity levels. The relationship between quality and these two factors forms
curved lines called isopreference curves.
Image Interpolation
Interpolation means 'filling in the gaps.' When you zoom into an image or rotate it, you need to
create new pixels at positions that did not exist before. There are three common methods:
• Nearest Neighbor Interpolation: Take the color of the closest existing pixel. Very fast
but produces blocky, jagged results.
• Bilinear Interpolation: Take the average of the 4 nearest pixels, weighted by distance.
Better quality, slightly slower.
• Bicubic Interpolation: Use the 16 nearest pixels for the best quality. This is the method
used by professional software like Adobe Photoshop.
Section 2.5: Some Basic Relationships Between Pixels
This section explains how pixels relate to each other, which is the foundation for many image
processing operations.
Pixel Neighbors
Every pixel has neighbors around it. There are three important types:
• 4-Neighbors (N4): The pixels directly above, below, left, and right. Only 4 pixels.
• Diagonal Neighbors (ND): The 4 diagonal pixels (top-left, top-right, bottom-left, bottom-
right).
• 8-Neighbors (N8): All 8 pixels surrounding a pixel = 4-neighbors + diagonal neighbors.
Adjacency and Connectivity
Two pixels are adjacent if they are neighbors AND have similar brightness values (both belong
to the same set V of allowed values).
There are three types of adjacency:
• 4-adjacency: Two pixels are 4-adjacent if one is in the 4-neighbors of the other and they
share the same value.
• 8-adjacency: Two pixels are 8-adjacent if one is in the 8-neighbors of the other and they
share the same value.
Easy Summary for Young Learners | Page 6
Digital Image Processing - Chapter 2 Summary
• m-adjacency (Mixed adjacency): A smarter version that avoids double-counting. A pixel
q is m-adjacent to p if it is a 4-neighbor, OR it is a diagonal neighbor AND there is no
common 4-neighbor with the same value. This removes ambiguous situations.
Paths, Regions, and Boundaries
A digital path is a series of connected pixels leading from one point to another. It is like drawing
a line on the image going only through pixels.
A connected region is a group of pixels where you can get from any pixel to any other pixel by
walking along adjacent pixels. Think of it like an island of pixels.
The boundary (border/contour) of a region is the set of pixels inside the region that touch
background pixels. It is the edge of the island.
Boundary vs. Edge: A boundary is a closed path around a whole region (global
concept). An edge is a local change in brightness at a specific point. Edges often
form boundaries but are not always the same thing.
Distance Measures
There are three ways to measure distance between two pixels p=(x,y) and q=(u,v):
• Euclidean Distance (De): The straight-line distance, like measuring with a ruler.
Formula: square root of ((x-u)^2 + (y-v)^2). Pixels within distance r form a circle.
• City-Block Distance (D4): Like walking through city blocks, only going
up/down/left/right. Formula: |x-u| + |y-v|. Pixels within distance d form a diamond shape.
• Chessboard Distance (D8): Like how a king moves in chess, can go diagonally.
Formula: maximum of (|x-u|, |y-v|). Pixels within distance d form a square.
Section 2.6: Introduction to Basic Mathematical Tools
This section introduces the math tools used throughout the book for processing digital images.
Think of these as the tools in a mathematical toolbox!
Elementwise vs. Matrix Operations
When working with images (which are matrices), there are two ways to multiply or divide:
• Elementwise (pixel-by-pixel): Multiply each pixel of image A with the matching pixel of
image B. This is what most image operations use.
• Matrix multiplication: Uses the standard rules of matrix algebra where each result pixel
depends on a whole row and column. Much less common in basic image work.
Throughout the book, ALL operations are elementwise UNLESS stated otherwise.
Easy Summary for Young Learners | Page 7
Digital Image Processing - Chapter 2 Summary
Linear vs. Non-Linear Operations
A very important classification is whether an operation is linear or non-linear.
An operation H is linear if it satisfies two conditions:
• Additivity: Applying H to two added images gives the same result as applying H
separately and then adding.
• Homogeneity: Multiplying an image by a constant before applying H gives the same
result as applying H first and then multiplying by the constant.
Why does this matter? Linear operations can be analyzed and understood much more easily,
and there is a huge body of mathematical theory supporting them. Many filters used in image
processing are linear.
Example: Adding image pixel values together is a linear operation. Finding the
maximum value in a neighborhood is non-linear.
Arithmetic Operations
Four basic math operations can be done on images (pixel by pixel):
• Addition (+): Used to average multiple images together to reduce noise. Key
application: in astronomy, combining many dark/noisy images to get a clear one.
• Subtraction (-): Used to find differences between images. Key applications: mask mode
radiography in medicine (subtracting an X-ray before injection from one after to reveal
blood vessel details), and quality control (comparing a product to a perfect reference).
• Multiplication (x): Used for shading correction (fixing uneven lighting) and masking
(isolating a region of interest).
• Division (/): Also used for shading correction to remove sensor artifacts.
After arithmetic, values may go out of the 0-255 range. We fix this by scaling: first shift
everything so minimum = 0, then scale so maximum = 255.
Set and Logical Operations
Images can also be treated as sets, especially binary images (where pixels are either 0 or 1).
Basic Set Theory
Important set operations include:
• Union (A or B): All pixels that are in A, in B, or in both. For grayscale, this means taking
the maximum of corresponding pixels.
• Intersection (A and B): Only pixels that are in BOTH A and B. For grayscale, this means
taking the minimum.
• Complement (not A): All pixels NOT in A. For grayscale, this means subtracting each
pixel from the maximum value (e.g., 255 - z for an 8-bit image, which gives the negative
of the image).
• Difference (A minus B): Pixels in A but not in B.
Logical Operations
Easy Summary for Young Learners | Page 8
Digital Image Processing - Chapter 2 Summary
Logical operations work on binary images where pixels are 0 (FALSE) or 1 (TRUE):
• AND: Result is 1 only if BOTH pixels are 1.
• OR: Result is 1 if EITHER pixel (or both) is 1.
• NOT: Flips 1s to 0s and 0s to 1s.
• XOR (Exclusive OR): Result is 1 only if the pixels are DIFFERENT (one is 0 and the
other is 1).
Spatial Operations
Spatial operations work directly on pixels. Three main categories:
1. Single-Pixel Operations
Change each pixel's value individually using a transformation function: s = T(z). For example,
the negative of an image flips brightness: if a pixel is dark, it becomes bright, and vice versa.
Formula for 8-bit negative: s = 255 - z.
2. Neighborhood Operations
Use a group of surrounding pixels to compute a new value. For example, local averaging:
replace each pixel with the average of all pixels in a small box (neighborhood) centered on it.
This blurs the image and removes fine details, but is useful for reducing noise.
3. Geometric Spatial Transformations
These change WHERE pixels are located rather than what value they have. Think of it as
stretching or rotating a rubber sheet. Two steps are needed: first move the pixel coordinates,
then assign a new intensity using interpolation.
Affine transformations are the most important class. They include:
• Identity: No change (the image stays the same).
• Scaling: Make the image bigger or smaller.
• Rotation: Spin the image by some angle.
• Translation: Move the image up, down, left, or right.
• Shearing: Slant the image (like pushing the top of a rectangle sideways).
All these can be expressed using a 3x3 matrix (called an Affine Matrix). By multiplying matrices,
you can combine multiple transformations into a single step.
Two methods to apply these transformations:
• Forward mapping: For each input pixel, calculate where it goes in the output. Problem:
some output locations may be missed.
• Inverse mapping: For each output pixel, calculate where it came from in the input. Then
use interpolation. This is the standard method used by software like MATLAB.
Image Registration
Image registration means aligning two images of the same scene so they line up perfectly. This
is needed when images are taken from different angles, at different times, or with different
cameras (like MRI and PET scans).
Easy Summary for Young Learners | Page 9
Digital Image Processing - Chapter 2 Summary
The process uses tie points (also called control points), which are specific points you can
identify in both images. By matching these points, you can calculate the transformation needed
to align one image with the other. The bilinear model uses 4 tie points to find 8 coefficients that
describe the transformation.
Example: Satellite images taken months apart need to be registered before
comparing them to spot changes on the ground.
Vector and Matrix Operations
Color images require more data than grayscale images because each pixel has THREE values
(red, green, and blue), not just one. We can represent this as a vector (a list of numbers):
For an RGB color pixel: z = [z1, z2, z3] where z1=red, z2=green, z3=blue.
Important vector operations:
• Inner product (dot product): Multiplies matching elements and adds them up. Gives one
number representing how similar two vectors are.
• Euclidean vector norm: The length of a vector. This is used to measure the distance
between two color pixels.
Entire images can be turned into very long vectors by stacking all columns. This allows us to
write complex image processing operations as simple linear equations: g = Hf + n, where f is the
input image, n is noise, H is a transformation matrix, and g is the output image.
Image Transforms
Sometimes it is much easier to process an image in a DIFFERENT domain rather than the
spatial domain (the pixel grid). The general process is:
• Step 1 - Transform: Convert the image from spatial domain to transform domain using a
forward transform.
• Step 2 - Process: Do the work in the transform domain (much easier for some tasks).
• Step 3 - Inverse Transform: Convert back to the spatial domain to get the output image.
The most important transform in image processing is the Fourier Transform. It converts the
image from a spatial view to a FREQUENCY view. In the frequency domain, repetitive patterns
(like interference or noise) appear as bright spots that can be easily removed.
Example: If an image has wavy interference lines (like TV static), the Fourier
transform shows bright dots at specific locations. Removing those dots and
transforming back eliminates the interference!
Other important transforms include: Walsh, Hadamard, Discrete Cosine Transform (DCT, used
in JPEG compression), Haar, and Slant transforms.
Image Intensities as Random Variables
In many image processing problems, we treat pixel brightness as if it were a random number.
This lets us use probability and statistics to describe and analyze images.
Easy Summary for Young Learners | Page 10
Digital Image Processing - Chapter 2 Summary
For an image with L possible intensity levels, the probability p(zk) of any intensity zk is: p(zk) =
(number of pixels with that intensity) / (total number of pixels).
Key statistics we can calculate from these probabilities:
• Mean (average): The average brightness of the whole image.
• Variance: How spread out the brightness values are. A high variance means high
contrast (lots of dark and bright areas). A low variance means dull, flat-looking image.
• Higher-order moments: More detailed statistics about the distribution of intensities.
These statistical concepts are used throughout the book for histogram-based enhancement
(Chapter 3), image restoration (Chapter 5), texture analysis (Chapter 11), and pattern
classification (Chapter 12).
Chapter Summary: What We Learned
Here is a quick recap of everything in Chapter 2:
• Section 2.1 - Eyes and Perception: Your eye has rods (night/no color) and cones
(day/color). Your brain can trick you with Mach bands and simultaneous contrast.
• Section 2.2 - Light: Light is electromagnetic waves. Visible light is just a tiny part of the
full EM spectrum from radio waves to gamma rays.
• Section 2.3 - Image Sensing: Cameras use sensors (single, strip, or 2D array) to capture
light. Every image = illumination x reflectance.
• Section 2.4 - Sampling & Quantization: Sampling puts the image on a grid. Quantization
assigns discrete brightness levels. More samples and levels = better quality.
Interpolation fills gaps when zooming or rotating.
• Section 2.5 - Pixel Relationships: Pixels have neighbors (4, 8). Connected pixels form
regions. We measure distances between pixels using Euclidean, city-block, or
chessboard distances.
• Section 2.6 - Math Tools: Images use elementwise arithmetic (add, subtract, multiply,
divide). Set operations (union, intersection, complement) and logical operations (AND,
OR, NOT) process binary images. Geometric transforms move pixels around. The
Fourier Transform moves from spatial to frequency domain for easier processing. Image
intensities can be treated as random variables using probability and statistics.
Easy Summary for Young Learners | Page 11
Digital Image Processing - Chapter 2 Summary
Easy Summary for Young Learners | Page 12