# Applied Image Processing

AI and Robotics

Nov 5, 2013 (4 years and 6 months ago)

119 views

Applied Image Processing

Introduction

Analog Image

Definition

Analog Examples/Processing

Digital Image

Definition

Digital Examples/Processing

Gray Scale and Color

Common Digital Image Manipulation

Noise (3-Common Types)
Introduction

Practically everything around us involves images and image processing

IMAGE:
An image can be defined as a two-dimensional signal (analog or
digital), that contains intensity (grayscale), or color information arranged along
an x and y spatial axis.
Trivial Example,
Let 1 represent White
Let 0 represent Black
00000
110
11
110
11
110
11
Digitize
Analog Images and Processing
Analog Image:
Can be mathematically represented as a continuous
range of values representing position and intensity.
Question:
How many coordinate points can be used to represent a
2-demsional grid, and how many divisions exist between the numbers
0 and 1?
EXAMPLE 11.1
Restated:
for an analog image the intensity
can be represented on a
normalized scale from 0 to 1 with infinite divisions
, and spatially
with
an infinite
number of coordinates.
Real Analog picture?
Examples Of Analog Images/Processors
Analog Photography: Camera and Film:

Camera is a light-proof box with a small opening (aperture) and a series of
lenses/mirrors to direct and focus light entering the aperture

A camera contains light-sensitive film positioned so that light passing through
the aperture will encounter it

Simple Black and White film is made up of a number of layers, one is known
as the emulsion layer which is covered with crystals of silver halide

Incoming light causes a chemical reaction to take place in the film causing
some of the silver halide crystals to be transformed into silver. The degree to
which the silver halide is converted is dependent on the amount of energy that
is absorbed which is proportional to the color and intensity of the incoming light

After being exposed the film must be developed before the picture can be
viewed
Simple Camera
Film
Shutter
Viewfinder
Mirro
r or Prism
Translucent Screen
Mirror
Lens
Inc
oming Light Pathway
Aperture
Film
Shutter
Viewfinder
Mirro
r or Prism
Translucent Screen
Mirror
Lens
Inc
oming Light Pathway
Aperture
Human Sight: The Eye:
The cornea is the clear front layer of the eye that allows for transmission and
focusing of light into the eye
The iris, the colored part of the eye, contracts and expands to change the size
of the pupil, which is the hole in the center of the iris that regulates the amount
of light entering the eye
The lens is the second part of the eye’s focusing system. Incoming light is first
focused by the cornea and then the lens performs the task of fine tuning the
focus.
Light focused by the lens is projected onto the retina, a layer of nerve cells that
line the back of the eye.
These light sensitive cells convert the light into electrical impulses that travel to
the brain, via the optic nerve, where they are decoded.
The Eye and Simplified Model
Pupil
Ir
is
Cornea
Lens
Retina
Optic Nerve
Mac
u
la
Fovea
Vitreous
B
lind Sp
o
t
(Optic Dis
k)
Pupil
Ir
is
Cornea
Lens
Retina
Optic Nerve
Mac
u
la
Fovea
Vitreous
B
lind Sp
o
t
(Optic Dis
k)
View
ed
Vie
wed
Ob
ject
Object
Lens
Lens
Retina
Retina
Imag
e
Image
View
ed
Vie
wed
Ob
ject
Object
Lens
Lens
Retina
Retina
Imag
e
Image
Digital Images and Processing
Digital Image:
a digital image is restricted in both its spatial
coordinates
and in its allowed intensities
Their positions and intensities are represented with discrete
values, or
elements
The discrete elements that make up a digital image are called picture
elements, or pixels

Matrices are perfect tools for mapping, representing, digital images

For example, an image that is 800 pixels wide and 600 pixels high can be
represented as a 600 x 800 matrix (600 rows and 800 columns)

Each element of the matrix, pixel, is used to represent a intensity. Recall;
00000
110
11
110
11
110
11
Digitize
Given a 17” computer screen which resolution would produce a higher
quality image?
a. 600 x 800
b. 1024 x 768

The acquisition of a digital image is a three step process
1). Sample and quantize position
2). Quantize intensity for each quantized position
3). Conversion to binary digits, encoding

A scanner or digital camera are commonly used for digitizing images

They contain sensor arrays that react to different intensity and wavelengths.
Power In
Pow
er In
Filter
Filter
Light Sensiti
ve
Light Sensitive
Material
Mate
rial
Intensity
Intensity
Signal
Signal
Incoming Light
Incoming Li
ght
Power In
Pow
er In
Filter
Filter
Light Sensiti
ve
Light Sensitive
Material
Mate
rial
Intensity
Intensity
Signal
Signal
Power In
Pow
er In
Filter
Filter
Light Sensiti
ve
Light Sensitive
Material
Mate
rial
Intensity
Intensity
Signal
Signal
Incoming Light
Incoming Li
ght
1). Sample and quantize:
Make intensity readings at evenly spaced locations in both the
x
and y
directions Visualized by placing an evenly spaced grid over the
analog image
2).
Quantize Intensity: quantize the sampled values of intensity to arrive at a signal that
is discrete in both position and amplitude.
3).
Encoding:
Convert data to binary form.
The sampling rate, must be high enough to capture the required detail.
Sample Image
Sample Image
Quantize Image
Quantize Image
Sample Image
Sample Image
Quantize Image
Quantize Image
The range of colors or shades of gray that can be represented in
the image
depend on the amount of space allotted
Quanti
ze
d 8 bits/sample
Quantized 8 bits/sample -
-
Quantized 4 bits/sample
Quantized 4
bits/sample -
-
16
Quantized 2 bits/sample
Quantized 2 bits/sample
-
-
Quantized 1 bi
t/sample
Quantized 1 bit/sample -
-
Quanti
ze
d 8 bits/sample
Quantized 8 bits/sample -
-
Quantized 4 bits/sample
Quantized 4
bits/sample -
-
16
Quantized 2 bits/sample
Quantized 2 bits/sample
-
-
Quantized 1 bi
t/sample
Quantized 1 bit/sample -
-
The process of analog to digital signal conversion is completed by
encoding the quantized values into a binary sequence.
Grayscale
Once a grayscale image has been captured and digitized, it is stored as a two-
dimensional array (a matrix) in computer memory
n
n
m
m
0
255
Black
White
n
n
m
m
n
n
m
m
0
255
Black
White
Each element contains the quantized intensity
, a value ranging from 0 to 255
EXAMPLE 11.2
Color

To digitize a grayscale image, we look at the overall intensity
level of the
sensed light and record as a function of position.

To digitize a color image the intensities of each of the three primary colors
must be detectable of the incoming light.

One way to accomplish this is to filter the light sensed by the
sensor so that
it lies within the wavelength range of a specific color.

We can detect the intensity of that specific color for that specific sample
location

Note the three primary colors are red, green, and blue. They are defined as
primary because any color of light consists of a combination of frequencies
contained in the three “primary” color ranges
As an example of quantizing a color image consider a computer imaging
systems that utilizes 24 bit color.
For 24 bit color each of the three primary color intensities is allowed one byte of
storage per pixel for a total of three bytes per pixel.
Each color has an allowed numerical range from 0 to 255, for example 0=no
red, 255=all red.
The combinations that can be made with 256 levels for each of the three
primary colors amounts to over 16 million distinct colors ranging from black
(R,G,B) = (0,0,0) to white (R,G,B) = (255,255,255).
Most computers store color digital image information in three dimensional
arrays. The first two indexes in this array specify the row and
column of the
pixel and the third index specifies the color “plane” where 1 is
red, 2 is green,
and 3 is blue.
3-Dim array for 24 bit color
n
n
m
m
3
3
Red
Red
Green
Green
Blue
Blue
0
255
n
n
m
m
3
3
Red
Red
Green
Green
Blue
Blue
n
n
m
m
3
3
Red
Red
Green
Green
Blue
Blue
0
255
EXAMPLE 11.3
Fundamental Color Models
RGB (Red, Green, Blue)
used primarily when direct light intensity produces
the color. Additive process, color presence is increased by increasing the
intensity of that color.
CMY (Cyan, Magenta, Yellow) used primarily when indirect or reflected light
intensity, light not absorbed, produces the color. Subtractive process, color
presence is increased by removing the absorbing color.
Referenced: http://micro.mag
net.fsu.edu
Common Di
gital Image Manipulation
Horizontal and Vertical Flipping: The operation requires only that you
change the order of the rows (vertical flipping) or columns (horizontal flipping)
12
3
11
0
1
3
2

1
0
0

2
30
0
1
1
1
2
3

3
2
1
11
0
1
2

1
0
0

30
0
1
⎡⎤
⎢⎥
⎢⎥
⎢⎥
⎣⎦
⎡⎤
⎢⎥
⎢⎥
⎢⎥
⎣⎦
Original Image
Original Image
Horizontal Flip
Horizontal Flip
Vertical Flip
Vertical Flip
Horizontal and Vertical F
lip
Horizontal and Vertical Flip
Original Image
Original Image
Horizontal Flip
Horizontal Flip
Vertical Flip
Vertical Flip
Horizontal and Vertical F
lip
Horizontal and Vertical Flip
Image Rotation: Simple rotation, clockwise and counterclockwise, taken in 90
degree increments.
100
100
01
1
⎡⎤
⎢⎥
⎢⎥
⎢⎥
⎣⎦
01
1
100
100
⎡⎤
⎢⎥
⎢⎥
⎢⎥
⎣⎦
R1

C3
R2

C2
R3

C1

Clockwise 900
Rotation
100
100
01
1

001
001
11
0

C1

R3
C2

R2
C3

R1

Counterclockwise 900
Rotation
Image Resizing: To shrink an image to half its original size, we must discard
half of the image’s pixel information. To accomplish, throw out every other row
and column in the image.
256 x 256
256 x 256
128 x 128
128 x 128
64 x 64
64 x 64
32 x 32
32 x 32
256 x 256
256 x 256
128 x 128
128 x 128
64 x 64
64 x 64
32 x 32
32 x 32
Image Noise
Noise is present in all analog devices, but digital signals have
some built-in
tolerance to noise due to the nature of their discreteness.
The three most common types of random noise you are likely to encounter
in images are white noise, salt and pepper noise, and speckle noise.
White Noise:
noise with a flat spectrum (meaning that it contains an equal
amount of all frequencies)
Salt and Pepper Noise:
a “spike” or impulse noise that drives the intensity
values of random pixels to either their maximum or minimum values. The
resulting black and white flecks in the image resemble salt and pepper.
Speckle Noise: a form of multiplicative noise in which the intensity values
of the pixels in the image are multiplied by random values
Image Noise Examples
Original Image
Original Image
I
mage + Gaussian White Noise
Image + Gaussian White Noise
Image + Speckle Noise
Image + Speckle Noise
Image + Salt & Pepper Noise
Image + Salt & Pepper Noise
Original Image
Original Image
I
mage + Gaussian White Noise
Image + Gaussian White Noise
Image + Speckle Noise
Image + Speckle Noise
Image + Salt & Pepper Noise
Image + Salt & Pepper Noise
Image Noise Removal
White Noise
•Most difficult to remove
•Can contain all frequencies in the spectrum
•Low-pass, Band-pass, High-pass????
Salt and Pepper Noise
•Simplest to handle
•Occurs when pixel’s intensities either driven to Min or Max values

To reduce
•choose a group of pixels in the image, say, for example, a 3x3 neighborhood
around a pixel
•Find the median of these values
•gives a typical intensity value for that neighborhood
•Replace the pixel with the median value and repeat
The median:
is defined as the center place holder of an ordered set of numbers,
for an odd number of numbers, or the average value of the two middle numbers, for
an even number of numbers.
EXAMPLE 11.4
What you should know
1.
Difference between an analog and digital image.
2.
Difference between the RGB and CMY models