Digital Image Fundamentals
Digital Image Fundamentals
processing (CoSc4151)
2. Digital Image Fundamentals
Jimma University
Jimma Institute of Technology
For Computer Science students
Abel W.
Concept of image
What is an image?
CV & IP 02 18-Nov-16 4
Concept of image
Image intensity, f(x, y), is proportional to EM
energy radiated/received 0 f ( x, y )
Required f(x, y) is nonzero and finite
f ( x , y ) i ( x, y ) r ( x, y )
where 0 i( x, y ) , incident illumination
0 r(x, y) 1, reflected illumination
Typical values: 90,000 lm/m 2 , clear sunny day
10,000 lm/m 2 , cloudy day
i(x,y) 2
0.01 lm/m , full moon, clear night
2
1,000 lm/m , commercial office
0.01, black material
r(x, y) 0.8, flat white wall paint
CV & IP 02
0.93, snow
18-Nov-16 5
Concept of image
Thus, the intensity image lies in the
range
i r f ( x, y ) i r
min min max max
0 f ( x, y ) L 1
CV & IP 02 18-Nov-16 6
Digital image representation
A digital image can be Where
represented as a two- f(x, y) =monochrome
dimensional (2D) matrix images of size M×N
of real numbers. X = row number (from 0
to M−1)
Y = column number
(between 0 and N−1)
CV & IP 02 18-Nov-16 7
Digital image representation
The value of the two-dimensional function f(x, y) at
any given pixel of coordinates (x0,y0), denoted by
f(x0,y0), is called the intensity or gray level of the
image at that pixel.
Maximum and Minimum values that a pixel intensity
can vary based on
data type
CV & IP 02 18-Nov-16 8
Digital image representation
1. Data Type
Logical: 1.0 for white and 0.0 for Black
uint8( unsigned integer, 8 bits): 0(Black) and 255(White)
2. Convection
CV & IP 02 18-Nov-16 10
Concept of pixel
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).
CV & IP 02 18-Nov-16 11
Concept of pixel
Pixel : [ p, I(p)] Pixel Location: p = (r , c)
Pixel Value: I(p) = I(r , c)
p = (r , c)
= (row # , col # )
=CV(&272,
IP 02
277) 18-Nov-16 12
Digital image acquisition process
CV & IP 02 18-Nov-16 13
Image sampling and quantization
An image may be continuous with respect to the x- and
y-coordinates, and also in amplitude.
When x, y, and the amplitude values are all finite,
discrete quantities, we call the image a digital image.
To convert it to digital form, we have to sample the
function in both coordinates and in amplitude.
1. Digitizing the coordinate values is called sampling.
2. Digitizing the amplitude values is called quantization.
CV & IP 02 18-Nov-16 14
Image sampling
Continuous image
CV & IP 02 18-Nov-16 17
Concepts of sampling and quantization
CV & IP 02 18-Nov-16 18
Types of Digital Image
Binary (1-Bit) Images
Gray-Level (8-Bit) Images
Color Images
CV & IP 02 18-Nov-16 19
Types of Digital Image
1. Binary (1-Bit) Images: encoded as a 2D array, typically
using 1 bit per pixel, where a 0 usually means “black” and a 1
means “white”
CV & IP 02 18-Nov-16 20
Types of Digital Image
2. Gray-Level (8-Bit) Images: (also referred to as
monochrome) encoded as a 2D array of pixels, usually with 8
bits per pixel, where a pixel value of 0 corresponds to “
black,” a pixel value of 255 means “white,” and intermediate
values indicate varying shades of gray
CV & IP 02 18-Nov-16 21
Gray-level images
Continuous image function f(x,y)
arguments - two co-ordinates (x,y) can have any value
Digital image functions - represented by matrices
co-ordinates = integer numbers
Cartesian (horizontal x axis, vertical y axis)
Monochromatic image function range
lowest value - black
highest value - white
Limited brightness values = grey levels
CV & IP 02 18-Nov-16 22
Gray level images
CV & IP 02 18-Nov-16 23
Representation of gray level images
a digital 8-bit, 8x8 images is shown as an array of numbers on the
left and brightness levels on the right.
CV & IP 02 18-Nov-16 24
Gray level images
• The number of distinct gray levels is usually a power
of 2 that is, 𝑳 = 𝟐𝑩
CV & IP 02 18-Nov-16 26
Cont.. Color Image
24-Bit (RGB) Color images, represented using three
2D arrays of same size, one for each color channel:
red (R), green (G), and blue (B)
Each array element contains an 8-bit value, indicating
the amount of red, green, or blue at that point in a
[0, 255] scale. The combination of the three 8-bit
values into a 24-bit number allows 2 raised to
24 (16,777,216, usually referred to as 16 million or 16
M) color combinations.
CV & IP 02 18-Nov-16 27
Cont’d… color images
Represented by vector not scalar
• Red, Green, Blue (RGB)
• Hue, Saturation, Value (HSV)
• Cyan, Magenta, Yellow (CMY)
Original Image
b. Red Plane
c. Green Plane
d. Blue Plane
CV & IP 02 18-Nov-16 29
Properties that define image format
CV & IP 02 18-Nov-16 30
Binary and Gray scale images
CV & IP 02 18-Nov-16 31
Intensity Resolution
Smallest discernible change in intensity level
CV & IP 02 18-Nov-16 33
Image of size
fewer Pixels Mean Lower Spatial Resolution
CV & IP 02 18-Nov-16 34
Image interpolation
Introduction
• An image f(x,y) tells us the intensity values at the
integral lattice locations, i.e., when x and y are both
integers
• Image interpolation refers to the “guess” of intensity values
at missing locations, i.e., x and y can be arbitrary
• Note that it is just a guess (Note that all sensors have finite
sampling distance)
• image interpolation is about D-A conversion
CV & IP 02 18-Nov-16 35
Image interpolation:
Image re-sampling or re-sizing operations:-
zooming, shrinking, rotating, and geometric corrections
CV & IP 02 18-Nov-16 37
Image Interpolation
How can we find f(1.5)?
One approach: take the average of f(1) and f(2)
f (1.5) = 5.5
CV & IP 02 18-Nov-16 38
Linear interpolation
Fit a line between each pair of data points
CV & IP 02 18-Nov-16 39
Linear interpolation
• What is f(1.8)?
Answer: 0.2 f(1) + 0.8 f(2)
CV & IP 02 18-Nov-16 40
Linear interpolation
To compute f(x), find the two points xleft and xright that x lies
between
f (x) = (xright - x) / (xleft – xright) f (xleft) +
(x - xleft) / (xleft – xright) f (xright)
f (xleft)
f (xright)
xleft x xright
CV & IP 02 18-Nov-16 41
Bilinear interpolation
What about in 2D?
Interpolate in x, then in y
Example
We know the red values
Linear interpolation in x between red
values gives us the blue values
Linear interpolation in y between the
blue values gives us the answer
http://en.wikipedia.org/wiki/
Bilinear_interpolation
CV & IP 02 42
18-Nov-16
Bilinear interpolation
Bilinear interpolation: - uses the
four nearest neighbors to estimate the
intensity at a the new location
http://en.wikipedia.org/wiki/
Bilinear_interpolation
CV & IP 02 43
18-Nov-16
Cont’d…
Nearest neighbor interpolation
Direct zooming
Bilinear interpolation
CV & IP 02 18-Nov-16 44
Extrapolation
Suppose you only know the values f(1), f(2), f(3), f(4)
of a function
What is f(5)?
This problem is called extrapolation
Much harder than interpolation: what is outside the image?
For the particular case of temporal data, extrapolation is
called prediction (what will the value of MSFT stock be
tomorrow?)
If you have a good model, this can work well
CV & IP 02 18-Nov-16 45
Image extrapolation
http://graphics.cs.cmu.edu/projects/scene-completion/
Computed using a database of millions of photos
CV & IP 02 18-Nov-16 46
Mathematical Tools used in Digital Image
Processing
1. Array versus Matrix Operations:
Digital image viewed as an array
Array operation is pixel-by-pixel
Consider image arrays A and B, where
a11 a12 b11 b12
A , B
21 22
a a 21 22
b b
then a11 a12
a 2
a 2
A b11 b12
A 2
2 11 12
2
, C
a21 a22 B a21 a22
b21 b22
CV & IP 02 18-Nov-16 47
Mathematical Tools used in Digital Image
Processing cont’d…
2. Linear versus Nonlinear Operations:
most image processing operations are linear.
Consider an input image f(x, y), an operator H
and output g(x, y), i.e.,
H[f(x, y)] = g(x, y)
H is a linear operator if the following is true.
H [ai f i ( x, y ) a j f j ( x, y )] ai g i ( x, y ) a j f j ( x, )
Mathematical Tools used in Digital Image
Processing cont’d…
3. Arithmetic Operations:
s ( x , y ) f ( x , y ) g ( x, y )
d ( x , y ) f ( x, y ) g ( x , y )
p ( x, y ) f ( x, y ) g ( x, y )
v ( x, y ) f ( x, y ) g ( x, y )
Thank you!!!
CV & IP 02 18-Nov-16 50