0% found this document useful (0 votes)
18 views42 pages

Lecture 2

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 42

CSE 511:Digital Image Processing

Lecture 2
Image formation
◼ There are two parts to the image formation
process:

◼ The geometry of image formation, which


determines where in the image plane the
projection of a point in the scene will be located.

◼ The physics of light, which determines the


brightness of a point in the image plane as a
function of illumination and surface properties.

March 23, 2022 Computer Science and Engineering, SUST 2


A Simple model of image formation

◼ The scene is illuminated by a single source.


◼ The scene reflects radiation towards the camera.
◼ The camera senses it via chemicals on film.

March 23, 2022 Computer Science and Engineering, SUST 3


Pinhole Camera
◼ This is the simplest device to form an image of a 3D scene
on a 2D surface.
◼ Straight rays of light pass through a “pinhole” and form an
inverted image of the object on the image plane.

March 23, 2022 Computer Science and Engineering, SUST 4


CCD (Charged-Coupled Device) cameras
◼ Tiny solid state cells convert light energy into electrical
charge.
◼ The image plane acts as a digital memory that can be
read row by row by a computer.

March 23, 2022 Computer Science and Engineering, SUST 5


Frame Grabber
◼ Usually, a CCD camera plugs into a computer board
(frame grabber).
◼ The frame grabber digitizes the signal and stores it in its
memory (frame buffer).

March 23, 2022 Computer Science and Engineering, SUST 6


Image Representation
◼ An image is a function of space
◼ Typically, a 2-D projection of the 3-D space is used,
but the image can exist in the 3-D space directly

March 23, 2022 Computer Science and Engineering, SUST 7


Image Representation
◼ Image as a single-valued function, for quantifying the
intensity.
◼ Image can be multi-valued function. The multiple
values may correspond to different color intensities,
for example, R, G, B makes color image.

◼ Notice that we defined images as functions in a


continuous domain.
◼ Images are representations of an analog
world. Hence, as with all digital signal
processing, we need to digitize our images

March 23, 2022 Computer Science and Engineering, SUST 8


Image Digitization

◼ Digitization of an analog signal involves two operations:


◼ Sampling
◼ Quantization
◼ Both operations correspond to a discretization of a quantity, but
in different domains.
Sampling
◼ An image may be continuous with respect to the
x- and y-coordinates and also in amplitude.

◼ Sampling corresponds to a discretization of the space.


That is, of the domain of the function.

◼ Digitizing the coordinate values is called Sampling.

◼ Digitizing the amplitude values is called Quantization.

March 23, 2022 Computer Science and Engineering, SUST 10


Sampling (Cont’d)

March 23, 2022 Computer Science and Engineering, SUST 11


Sampling (Cont’d)
◼ Image can be seen as a matrix
 f(0,0) f(0,1) ... f(0, N − 1) 
 f(1,0) f(1,1) ... f(1, N − 1) 
 
 . . . . 
 . . . . 
 
 . . . . 
f(M − 1,0) f(M − 1,1) ... f(M − 1, N − 1)
◼ The smallest element resulting from the
discretization of the space is called a pixel
(picture element).

◼ For 3-D images, this element is called a voxel


(volumetric pixel)

March 23, 2022 Computer Science and Engineering, SUST 12


Image quantization (example)

March 23, 2022 Computer Science and Engineering, SUST 13


Summary: Sampling and Quantization

March 23, 2022 Computer Science and Engineering, SUST 14


Sampling and Quantization

pixel grid

real image sampled quantized sampled &


quantized

March 23, 2022 Computer Science and Engineering, SUST 15


Digital Image
Color images have 3 values per
pixel; monochrome images have 1
value per pixel.

a grid of squares,
each of which
contains a single
color

each square is
called a pixel (for
picture element)

March 23, 2022 Computer Science and Engineering, SUST 16


Pixels

◼ A digital image, I, is a mapping from a 2D grid


of uniformly spaced discrete points, {p = (r,c)},
into a set of positive integer values, {I( p)}, or a
set of vector values, e.g., {[R G B]T( p)}.

◼ At each column location in each row of I there


is a value.

◼ The pair ( p, I( p) ) is called a “pixel” (for


picture element).

March 23, 2022 Computer Science and Engineering, SUST 17


Pixels

◼ p = (r,c) is the pixel location indexed by row, r,


and column, c.

◼ I( p) = I(r,c) is the value of the pixel at location p.

◼ If I( p) is a single number then I is monochrome.

◼ If I( p) is a vector (ordered list of numbers) then I


has multiple bands (e.g., a color image).

March 23, 2022 Computer Science and Engineering, SUST 18


Pixels

Pixel Location: p = (r , c)
Pixel Value: I(p) = I(r , c) Pixel : [ p, I(p)]

March 23, 2022 Computer Science and Engineering, SUST 19


A Simple Image Formation Model
◼ An image is a 2-D light intensity function f(x,y)
◼ +ve scalar quantity in spatial domain
◼ Physical meaning is determined by the source of the image

◼ An image is formed through the mapping of 3D scene


onto 2D surface or plane.

◼ The light intensity distribution f(x,y), over that plane


characterizes the image and is considered to be
dependent on 2 distributions- illumination and
reflectance.
◼ The image is modeled as Illumination-Reflectance
model

March 23, 2022 Computer Science and Engineering, SUST 20


The Illumination- Reflectance Model
◼ Illumination- i(x,y): The amount of source
illumination incident on the scene being viewed or
amount of illumination received by the various
objects
◼ Typical values: 9000 foot-candles sunny day, 100 office
room, 0.01 moonlight

◼ Reflectivity- r(x,y): Amount of illumination reflected


by the objects in the scene
◼ r(x,y) is the reflectance: 0 < r(x,y) < 1
◼ r(x,y)=0 implies total absorption
◼ r(x,y)=1 implies total reflectance
◼ Typical values: 0.01 black velvet, 0.80 flat white paint, 0.93
snow

March 23, 2022 Computer Science and Engineering, SUST 21


The Illumination- Reflectance Model
◼ f(x,y) and i(x,y) are +ve for all values of x and y, i.e.,
◼ 0 ≤f(x,y)< ∞
◼ 0 ≤i(x,y)< ∞

f(x, y)
◼ By definition: r(x, y) =
i(x, y)
f(x, y) = r(x, y)i(x, y)

◼ r(x,y) characterizes the various objects in the scene


and can be expressed as the product of 2 components

March 23, 2022 Computer Science and Engineering, SUST 22


Simple Imaging Model
◼ The intensity of a monochrome image f at (x,y) is the gray level
(l) of the image at that point.
Lmin≤ l ≤ Lmax

◼ In practice Lmin=iminrmin and Lmax=imaxrmax


◼ As a guideline Lmin ≈ 10 and Lmax ≈ 1000 for indoor image
processing applications

◼ The interval [Lmin, Lmax] is called the gray scale

◼ Common practice is to shift the interval to [0, L-1] where l=0 is


considered black and l=L-1 is considered white. All intermediate
values are shades of gray

March 23, 2022 Computer Science and Engineering, SUST 23


Sampling and Quantization

pixel grid

real image sampled quantized sampled &


quantized

March 23, 2022 Computer Science and Engineering, SUST 24


Sampling and Quantization

March 23, 2022 Computer Science and Engineering, SUST 25


Sampling and Quantization

March 23, 2022 Computer Science and Engineering, SUST 26


Representing Digital Image

◼ Result of sampling and quantization


◼ Matrix of real numbers
◼ M x N digital image
 f(0,0) f(0,1) ... f(0, N − 1) 
 
 f(1,0) f(1,1) ... f(1, N − 1) 
 . . . . 
 . . . . 
 
 . . . . 
f(M − 1,0) f(M − 1,1) ... f(M − 1, N − 1)

◼ What’s the size of M and N and L- gray levels?

March 23, 2022 Computer Science and Engineering, SUST 27


Representing Digital Images
◼ No requirements of M and N other than to be +ve integers
◼ Due to processing, storage and sampling hardware considerations,
the number of gray levels L is typically power of 2
◼ L=2k
◼ [0,L-1] – dynamic range of an image
◼ Image whose gray levels span a significant portion of the gray
scale- high dynamic range- high contrast
◼ Low dynamic range- dull washed out gray look

◼ The number of bits, b, necessary to store the image is then


◼ b=M x N x k, when M=N it becomes b=N2k

◼ For example, a 128x128 image with 64 gray levels would require


98,304 bits of storage: b=128x128x6

March 23, 2022 Computer Science and Engineering, SUST 28


Storage Bits Requirements

◼ How many samples and gray levels are required for a “good”
approximation?

◼ The resolution (the degree of discernible detail) depends strongly on


these two parameters

March 23, 2022 Computer Science and Engineering, SUST 29


Image Resolution
◼ Digital image implies the discretization of both spatial
and intensity values. The notion of resolution is valid
in either domain.

◼ Most often it refers to the resolution in sampling-


Spatial resolution.

◼ It also can refer to the number of quantization levels.

March 23, 2022 Computer Science and Engineering, SUST 30


Resolution: How Much Is Enough?

◼The big question with resolution is always how much is


enough?
◼ This all depends on what is in the image and what you
would like to do with it
◼ Key questions include
◼ Does the image look aesthetically pleasing?
◼ Can you see what you need to see within the image?

March 23, 2022 Computer Science and Engineering, SUST 31


Resolution: How Much Is Enough?(cont…)

◼The picture on the right is fine for counting the


number of cars, but not for reading the number
plate

March 23, 2022 Computer Science and Engineering, SUST 32


Spatial Resolution
◼ Sampling is the principal factor determining the
Spatial Resolution of an image
◼ Smallest discernible detail in an image

◼ Example:
◼ Construct a chart with vertical lines of width W, with the
space between lines also having width W
◼ One line and its adjacent space- Line pair, width 2W,
therefore 1/2W line pairs per unit distance

◼ Resolution: Smallest number of discernible line pairs


per unit distance. Usually 100 line pairs per mm

March 23, 2022 Computer Science and Engineering, SUST 33


Spatial Resolution
1250dpi 300dpi
◼ Dot (pixels) per inch- DPI

◼ Examples:
◼ Newspapers 75dpi
◼ Magazines 133dpi
◼ Glossy brochures 175dpi 150dpi 72dpi

March 23, 2022 Computer Science and Engineering, SUST 34


Gray-Level/ Intensity Resolution
◼ Smallest discernible change in gray level- highly
subjective process
◼ Discretion regarding the number of samples used to
generate a digital image, but this is not true for the
number of gray levels.
◼ Due to hardware considerations, # of gray levels
usually an integer power of 2.
◼ Most common: 8 bits, 16 bits used in some
applications
◼ Terminology: L-level digital image of size M x N
◼ Spatial resolution: M x N
◼ Gray level resolution: L

March 23, 2022 Computer Science and Engineering, SUST 35


Effects of Reducing Spatial Resolution

March 23, 2022 Computer Science and Engineering, SUST 37


Effects of Reducing Gray Level

March 23, 2022 Computer Science and Engineering, SUST 38


Effects of Reducing Gray Level

March 23, 2022 Computer Science and Engineering, SUST 39


Neighbors of a Pixel
◼ An image is denoted by: f(x,y)
◼ Lowercase letters (e.g. p, q) will denote individual pixels
◼ A subset of f(x,y) is denoted by S

◼ Neighbors of a pixel:
◼ A pixel p at (x,y) has 4 horizontal/vertical neighbors at
◼ (x+1,y), (x-1,y), (x, y+1) and (x, y-1)
◼ called the 4-neighbors of p: N4(p)
◼ A pixel p at (x,y) has 4 diagonal neighbors at
◼ (x+1,y+1), (x+1,y-1), (x-1, y+1) and (x-1, y-1)
◼ called the diagonal-neighbors of p: ND(p)
◼ The 4-neighbors and the diagonal-neighbors of p are
called the 8-neighbors of p: N8(p)

March 23, 2022 Computer Science and Engineering, SUST 40


Example

4-Neighbors

March 23, 2022 Computer Science and Engineering, SUST 41


Connectivity Between Pixels
◼ Connectivity is an important concept in establishing boundaries
of object and components of regions in an image

◼ When are two pixels connected?


◼ If they are adjacent in some sense (say they are 4-neighbors)
◼ and, if their gray levels satisfy a specified criterion of similarity (say
they are equal)

◼ Example: given a binary image (e.g. gray scale = [0,1]), two


pixels may be 4-neighbors but are not considered connected
unless they have the same value

0 1
1 1

March 23, 2022 Computer Science and Engineering, SUST 42

You might also like