# Search in the document preview

**Dr. D. J. Jackson Lecture 2-1Electrical & Computer Engineering
**

**Computer Vision &
Digital Image Processing
**

Dr. David Jeff Jackson Electrical & Computer Engineering

The University of Alabama

**Dr. D. J. Jackson Lecture 2-2Electrical & Computer Engineering
**

**Elements of visual perception
**

• Goal: help an observer interpret the content of an image

• Developing a basic understanding of the visual process is important

• Brief coverage of human visual perception follows – Emphasis on concepts that relate to subsequent material

**Dr. D. J. Jackson Lecture 2-3Electrical & Computer Engineering
**

**Cross section of the human eye
**

• Eye characteristics – nearly spherical – approximately 20 mm in

diameter – three membranes

• cornea (transparent) & sclera (opaque) outer cover

• choroid contains a network of blood vessels, heavily pigmented to reduce amount of extraneous light entering the eye. Also contains the iris diaphragm (2-8 mm to allow variable amount of light into the eye)

• retina is the inner most membrane, objects are imaged on the surface

**Dr. D. J. Jackson Lecture 2-4Electrical & Computer Engineering
**

**Retinal surface
**

• Retinal surface is covered in discrete light receptors • Two classes

– Cones
• 6-7 million located primarily near the center of the retina (the *fovea*)
• highly sensitive to color
• can resolve fine details because each is attached to a single nerve

ending
• Cone vision is called *photopic *or bright-light vision

– Rods
• 75-150 million distributed over the retinal surface
• multiple rods connected to a single nerve ending
• give a general overall picture of the field of illumination
• not color sensitive but are sensitive to low levels of illumination
• Rod vision is called *scotopic *or dim-light vision

**Dr. D. J. Jackson Lecture 2-5Electrical & Computer Engineering
**

**Distribution of rods and cones
**

**Dr. D. J. Jackson Lecture 2-6Electrical & Computer Engineering
**

**Distribution of receptors (continued)
**

• Distribution is radially symmetric about the fovea
• Absence of receptors in the *blind spot *(emergence of the

optic nerve) • Receptor density measured in degrees from the fovea (the

angle formed between the visual axis and a line extending from the center of the lens to the retina)

• Fovea: – circular indentation in the retina (approximately 1.5 mm in diameter) – density of cones in that area is approximately 150,000/mm2

– basic ability of the eye to resolve detail is within the realm of electronic imaging sensors

**Dr. D. J. Jackson Lecture 2-7Electrical & Computer Engineering
**

**Imaging in the eye
**

• Variable thickness lens: thick for close focus, thin for distant focus

• Distance of focal center of the lens to the retina (14-17 mm) • Image of a 15m tree at 100m

15/100 = X/17 or approximately 2.55 mm

• Image is almost entirely on the fovea

**Dr. D. J. Jackson Lecture 2-8Electrical & Computer Engineering
**

**A simple imaging model
**

• An image is a 2-D light intensity function *f(x,y)
*• As light is a form of energy

*0 < f(x,y) < *∞
• f(x,y) may be expressed as the product of 2 components

*f(x,y)=i(x,y)r(x,y)
*

• i(x,y) is the illumination: 0 < i(x,y) < ∞ – Typical values: 9000 foot-candles sunny day, 100 office room, 0.01

moonlight

• 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

**Dr. D. J. Jackson Lecture 2-9Electrical & Computer Engineering
**

**A simple imaging model (continued)
**

• The intensity of a monochrome image *f *at (*x,y*) is the *gray
level *(*l*) of the image at that point

• In practice Lmin=iminrmin and Lmax=imaxrmax • As a guideline Lmin ≈ 0.005 and Lmax ≈ 100 for indoor

image processing applications
• The interval [Lmin, Lmax] is called the *gray scale
*• Common practice is to shift the interval to [0,L] where l=0 is

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

maxmin *LlL *≤≤

**Dr. D. J. Jackson Lecture 2-10Electrical & Computer Engineering
**

**Sampling and quantization
**

• To be suitable for computer processing an image, f(x,y) must be digitized both spatially and in amplitude

• Digitizing the spatial coordinates is called *image sampling
*• Amplitude digitization is called gray-level quantization
• f(x,y) is approximated by equally spaced samples in the form

of an NxM array where each element is a discrete quantity

⎥ ⎥ ⎥ ⎥

⎦

⎤

⎢ ⎢ ⎢ ⎢

⎣

⎡

−−−−

− −

≈

)1,1(...)1,1()0,1( .

)1,1(...)1,1()0,1( )1,0(...)1,0()0,0(

),(

*MNfNfNf
*

*Mfff
Mfff
*

*yxf*

**Dr. D. J. Jackson Lecture 2-11Electrical & Computer Engineering
**

**Sampling and quantization (continued)
**

• Common practice is to let N and M be powers of two; N=2n and M=2k

• And G=2m where G denotes the number of gray levels • The assumption here is that gray levels are equally space in the interval

[0,L] • The number of bits, b, necessary to store the image is then

• For example, a 128x128 image with 64 gray levels would require 98,304 bits of storage

*mNb
*

*MNifor
NxMxmb
*

2=

= =

**Dr. D. J. Jackson Lecture 2-12Electrical & Computer Engineering
**

**Sampling and quantization (continued)
**

Number of 8-bit bytes of storage for various values of N and m N\m 1 2 3 4 5 6 7 8

32 128 256 512 512 1024 1024 1024 1024 64 512 1024 2048 2048 4096 4096 4096 4096

128 2048 4096 8192 8192 16384 16384 16384 16384 256 8192 16384 32768 32768 65536 65536 65536 65536 512 32768 65536 131072 131072 262144 262144 262144 262144

1024 131072 262144 393216 524288 655360 786432 917504 1048576

• 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

**Dr. D. J. Jackson Lecture 2-13Electrical & Computer Engineering
**

**Effects of reducing spatial resolution
**

Pixel replication occurs as resolution is decreased

128x128256x256

32x3264x64

**Dr. D. J. Jackson Lecture 2-14Electrical & Computer Engineering
**

**Effects of reducing gray levels
**

Ridgelike structures develop as gray level is decreased: false contours

256

64

128

32

**Dr. D. J. Jackson Lecture 2-15Electrical & Computer Engineering
**

**Basic relationships between pixels
**

• 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)
*

**Dr. D. J. Jackson Lecture 2-16Electrical & Computer Engineering
**

**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

**Dr. D. J. Jackson Lecture 2-17Electrical & Computer Engineering
**

**Connectivity between pixels (continued)
**

• Let *V *be the set of values used to determine connectivity
– For example, in a binary image, *V*={1} for the connectivity of pixels

with a value of 1 – In a gray scale image, for the connectivity of pixels with a range of

intensity values of, say, 32 to 64, it follows that *V*={32,33,…,63,64}
– Consider three types of connectivity

• *4-connectivity*: Pixels *p *and *q *with values from *V *are *4-connected *if *q *is
in the set *N4(p)
*

• *8-connectivity*: Pixels *p *and *q *with values from *V *are *8-connected *if *q *is
in the set *N8(p)
*

• *m-connectivity (mixed)*: Pixels *p *and *q *with values from *V *are *m-
connected *if

– *q *is in the set *N4(p), or
*– *q *is in the set *ND(p) and *the set *N4(p) *∩ *N4(q) *is empty (This is the set of

pixels that are 4-neighbors of *p *and *q *and whose values are from *V*)

**Dr. D. J. Jackson Lecture 2-18Electrical & Computer Engineering
**

**Connectivity example
**

0 1 1

0 1 0

0 0 1

0 1 1

0 1 0

0 0 1

0 1 1

0 1 0

0 0 1

An arrangement of pixels

8-connectivity of the pixels

V={1}

m-connectivity of the pixels

V={1}

**Dr. D. J. Jackson Lecture 2-19Electrical & Computer Engineering
**

**Pixel adjacencies and paths
**

• Pixel *p *is adjacent to *q *if they are connected
– We can define 4-, 8-, or m-adjacency depending on the specified type

of connectivity

• Two image subsets S1 and S2 are adjacent if some pixel in S1 is adjacent to S2

• A path from *p *at (*x,y*) to *q *at (*s,t*) is a sequence of distinct
pixels with coordinates (x0,y0), (x1,y1),….., (xn,yn)
– Where (x0,y0)=(x,y) and (xn,yn)=(s,t) and
– (xi,yi) is adjacent to (xi-1,yi-1) for 1<= i <= n
– n is the *length *of the path

• If *p *and *q *are in *S*, then *p *is connected to *q *in *S *if there is a
path from *p *to *q *consisting entirely of pixels in *S
*

**Dr. D. J. Jackson Lecture 2-20Electrical & Computer Engineering
**

**Example paths
**

0 1 1

0 1 0

0 0 1

0 1 1

0 1 0

0 0 1

A 4-connected path from p to q (n=2). p and q are

connected in S1

An m-connected path from t to q (n=3). t and q are

connected in S2

p q q

t

Subset S1 Subset S2

**Dr. D. J. Jackson Lecture 2-21Electrical & Computer Engineering
**

**Connected components
**

• For any pixel *p *in *S*, the set of pixels connected to *p
*form a connected component of *S
*

• Distinct connected components in *S *are said to be
*disjoint
*

1 0 1 1

1 0 1 0

0 0 0 1

1 0 1 1

1 0 1 0

0 0 0 1 3 4-connected

components of S 2 m-connected

components of S

**Dr. D. J. Jackson Lecture 2-22Electrical & Computer Engineering
**

**Labeling 4-connected components
**

• Consider scanning an image pixel by pixel from left to right and top to bottom

– Assume, for the moment, we are interested in 4-connected components

– Let *p *denote the pixel of interest, and *r *and *t *denote the upper and
left neighbors of *p*, respectively

– The nature of the scanning process assures that *r *and *t *have been
encountered (and labeled if 1) by the time *p *is encountered

r

t p

**Dr. D. J. Jackson Lecture 2-23Electrical & Computer Engineering
**

**Labeling 4-connected components
(continued)
**• Consider the following procedure

if p=0 continue to the next position if r=t=0 assign a new label to p (Ln) if r=t=1 and they have the same label, assign that label to p if only one of r and t are 1, assign its label to p if r=t=1 and they have different labels, assign one label to p and

note that the two labels are equivalent (that is r and t are connected through p)

At the end of the scan, sort pairs of equivalent labels into equivalence classes and assign a different label to each class

**Dr. D. J. Jackson Lecture 2-24Electrical & Computer Engineering
**

**Labeling 4-connected components
(example)
**

0 1 0 1 1 1 0 1 0 1 1 0 1 0 0 0 0 0 0 1

L0 L1

L2

L0

L1 L0 L0

L3 L4

0 1 0 1 1 1 0 1 0 1 1 0 1 0 0 0 0 0 0 1

L0 L1

L0

L0

L1 L0 L0

L2 L3

Before equivalence class labeling

After equivalence class labeling

L2=L0

**Dr. D. J. Jackson Lecture 2-25Electrical & Computer Engineering
**

**Labeling 8-connected components
**

• Proceed as in the 4-connected component labeling case, but also
examine two upper diagonal neighbors (*q *and *s*) of *p
*

0 1 0 1 1 1 0 1 0 1 1 0 1 0 0 0 0 0 0 1

L0 L1

L0

L0

L1 L0 L0

L0 L2

0 1 0 1 1 1 0 1 0 1 1 0 1 0 0 0 0 0 0 1

L0 L0

L0

L0

L0 L0 L0

L0 L1

Before equivalence class labeling

After equivalence class labeling

L1=L0

**Dr. D. J. Jackson Lecture 2-26Electrical & Computer Engineering
**

**Labeling connected components
in non-binary images
**

• The 4-connected or 8-connected labeling schemes can be extended to gray level images

• The set *V *may be used to connect into a component only
those pixels within a specified range of pixel values

000 000 000 000 000 000 000 128 000 000 000 128 255 128 000 000 128 255 128 000 000 000 128 000 000 000 000 000 000 000

L0 L0 L1 L0 L0 L1 L0

L0