Вы находитесь на странице: 1из 114

Chapter-1 and 2

Subject: FIP (181102)


Prof. Asodariya Bhavesh
ECD,SSASIT, Surat
Digital Image Processing, 3rd edition by
Gonzalez and Woods
Optics and Human Vision

The physics of light

http://commons.wikimedia.org/wiki/File:Eye-diagram_bg.svg
Light
Light
Particles known as photons
Act as waves
Two fundamental properties
Amplitude
Wavelength
Frequency is the inverse of wavelength
Relationship between wavelength (lambda) and frequency (f)

c/ f
Where c = speed of light = 299,792,458 m / s
4
What is Digital Image Processing?
Digital image processing focuses on two major tasks
Improvement of pictorial information for human interpretation
Processing of image data for storage, transmission and
representation for autonomous machine perception
Some argument about where image processing ends and
fields such as image analysis and computer vision start
What is DIP? (cont)
The continuum from image processing to computer vision
can be broken up into low-, mid- and high-level processes

Low Level Process Mid Level Process High Level Process


Input: Image Input: Image Input: Attributes
Output: Image Output: Attributes Output: Understanding
Examples: Noise Examples: Object Examples: Scene
removal, image recognition, segmentation understanding,
sharpening autonomous navigation

In this course we will stop


here
History of Digital Image Processing
Early 1920s: One of the first applications of digital imaging
was in the news-
Images taken from Gonzalez & Woods, Digital Image Processing (2002)

paper industry
The Bartlane cable picture
transmission service
Images were transferred by submarine cable between London
Early digital image
and New York
Pictures were coded for cable transfer and reconstructed at
the receiving end on a telegraph printer
History of DIP (cont)
Mid to late 1920s: Improvements to the Bartlane system
resulted in higher quality images
Images taken from Gonzalez & Woods, Digital Image Processing (2002)

New reproduction
processes based
on photographic
techniques
Increased number
of tones in
reproduced images

Improved
digital image Early 15 tone digital image
History of DIP (cont)
1960s: Improvements in computing technology and the
onset of the space race led to a surge of work in digital
Images taken from Gonzalez & Woods, Digital Image Processing (2002)

image processing
1964: Computers used to
improve the quality of
images of the moon taken
by the Ranger 7 probe
Such techniques were used
in other space missions
including the Apollo landings

A picture of the moon taken by


the Ranger 7 probe minutes
before landing
History of DIP (cont)
1970s: Digital image processing begins to be used in
medical applications
Images taken from Gonzalez & Woods, Digital Image Processing (2002)

1979: Sir Godfrey N.


Hounsfield & Prof. Allan M.
Cormack share the Nobel
Prize in medicine for the
invention of tomography,
the technology behind
Computerised Axial
Tomography (CAT) scans
Typical head slice CAT image
Key Stages in Digital Image Processing

Image Morphological
Restoration Processing

Image
Segmentation
Enhancement

Image Object
Acquisition Recognition

Representation
Problem Domain
& Description
Colour Image Image
Processing Compression
Key Stages in Digital Image Processing:
Image Aquisition
Images taken from Gonzalez & Woods, Digital Image Processing (2002)

Image Morphological
Restoration Processing

Image
Segmentation
Enhancement

Image Object
Acquisition Recognition

Representation
Problem Domain
& Description
Colour Image Image
Processing Compression
Key Stages in Digital Image Processing:
Image Enhancement
Images taken from Gonzalez & Woods, Digital Image Processing (2002)

Image Morphological
Restoration Processing

Image
Segmentation
Enhancement

Image Object
Acquisition Recognition

Representation
Problem Domain
& Description
Colour Image Image
Processing Compression
Key Stages in Digital Image Processing:
Image Restoration
Images taken from Gonzalez & Woods, Digital Image Processing (2002)

Image Morphological
Restoration Processing

Image
Segmentation
Enhancement

Image Object
Acquisition Recognition

Representation
Problem Domain
& Description
Colour Image Image
Processing Compression
Key Stages in Digital Image Processing:
Morphological Processing
Images taken from Gonzalez & Woods, Digital Image Processing (2002)

Image Morphological
Restoration Processing

Image
Segmentation
Enhancement

Image Object
Acquisition Recognition

Representation
Problem Domain
& Description
Colour Image Image
Processing Compression
Key Stages in Digital Image Processing:
Segmentation
Images taken from Gonzalez & Woods, Digital Image Processing (2002)

Image Morphological
Restoration Processing

Image
Segmentation
Enhancement

Image Object
Acquisition Recognition

Representation
Problem Domain
& Description
Colour Image Image
Processing Compression
Key Stages in Digital Image Processing:
Object Recognition
Images taken from Gonzalez & Woods, Digital Image Processing (2002)

Image Morphological
Restoration Processing

Image
Segmentation
Enhancement

Image Object
Acquisition Recognition

Representation
Problem Domain
& Description
Colour Image Image
Processing Compression
Key Stages in Digital Image Processing:
Representation & Description
Images taken from Gonzalez & Woods, Digital Image Processing (2002)

Image Morphological
Restoration Processing

Image
Segmentation
Enhancement

Image Object
Acquisition Recognition

Representation
Problem Domain
& Description
Colour Image Image
Processing Compression
Key Stages in Digital Image Processing:
Image Compression

Image Morphological
Restoration Processing

Image
Segmentation
Enhancement

Image Object
Acquisition Recognition

Representation
Problem Domain
& Description
Colour Image Image
Processing Compression
Key Stages in Digital Image Processing:
Colour Image Processing

Image Morphological
Restoration Processing

Image
Segmentation
Enhancement

Image Object
Acquisition Recognition

Representation
Problem Domain
& Description
Colour Image Image
Processing Compression
Visible Spectrum

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Light

Diagram of a light wave.

22
Conventional Coordinate for Image Representation

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Digital Image Types : Intensity Image

Intensity image or monochrome image


each pixel corresponds to light intensity
normally represented in gray scale (gray
level).

Gray scale values


10 10 16 28
9 6 26 37

15 25 13 22

32 15 87 39
Digital Image Types : RGB Image

Color image or RGB image:


each pixel contains a vector
representing red, green and
blue components.

RGB components
10 10 16 28
9 656 70 26
56 43
3756 78
32 99 54 96 67
70
15 256013 902296 67
21 54 47 42
85 85 43 92
32 15 87 39
54 65 65 39
32 65 87 99
Image Types : Binary Image

Binary image or black and white image


Each pixel contains one bit :
1 represent white
0 represents black

Binary data
0 0 0 0
0 0 0 0

1 1 1 1

1 1 1 1
Image Types : Index Image

Index image
Each pixel contains index number
pointing to a color in a color table

Color Table

Index Red Green Blue


component component component
No.
1 0.1 0.5 0.3
2 1.0 0.0 0.0
1 4 9
6 4 7 3 0.0 1.0 0.0
4 0.5 0.5 0.5
6 5 2
5 0.2 0.8 0.9
Index value
Cross Section of the Human Eye

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Human Eye

29
Anatomy of the Human Eye

30 Source: http://webvision.med.utah.edu/
Human Visual System
Human vision
Cornea acts as a protective lens that roughly focuses
incoming light
Iris controls the amount of light that enters the eye
The lens sharply focuses incoming light onto the retina
Absorbs both infra-red and ultra-violet light which can damage the
lens
The retina is covered by photoreceptors (light sensors)
which measure light

31
Photoreceptors
Rods
Approximately 100-150 million rods
Non-uniform distribution across the retina
Sensitive to low-light levels (scotopic vision)
Lower resolution

Cones
Approximately 6-7 million cones
Sensitive to higher-light levels (photopic vision)
High resolution
Detect color by the use of 3 different kinds of cones each of
which is sensitive to red, green, or blue frequencies
Red (L cone) : 564-580 nm wavelengths (65% of all cones)
Green (M cone) : 534-545 nm wavelengths (30% of all cones)
Blue (S cone) : 420-440 nm wavelengths (5% of all cones)

33
Cone (LMS) and Rod (R) responses

34 http://en.wikipedia.org/wiki/File:Cone-response.svg
Photoreceptor density across retina

35
Comparison between rods and cones

Rods Cones
Used for night vision Used for day vision
Loss causes night blindness Loss causes legal blindness
Low spatial resolution with higher noise High spatial resolution with lower noise
Not present in fovea Concentrated in fovea
Slower time response to light Quicker time response to light
One type of photosensitive pigment Three types of photosensitive pigment
Emphasis on motion detection Emphasis on detecting fine detail

36
Color and Human Perception
Chromatic light
has a color component

Achromatic light
has no color component
has only one property intensity

37
Image Formation in the Human Eye

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.

(Picture from Microsoft Encarta 2000)


Brightness Adaptation

Actual light intensity is (basically)


log-compressed for perception.

Human vision can see light between


the glare limit and scotopic
threshold but not all levels at the
same time.

The eye adjusts to an average value


(the red dot) and can simultaneously
see all light in a smaller range
surrounding the adaptation level.

Light appears black at the bottom of


the instantaneous range and white
at the top of that range.

39
Weber Ratio I/I
Weber Ratio
Human Visual Perception
Light intensity:
The lowest (darkest) perceptible intensity is the scotopic threshold
The highest (brightest) perceptible intensity is the glare limit
The difference between these two levels is on the order of 1010
We cant discriminate all these intensities at the same time! We adjust
to an average value of light intensities and then discriminate around the
average.

Log compression.
Experimental results show that the relationship between the
perceived amount of light and the actual amount of light in a scene
are generally related logarithmically.
The human visual system perceives brightness as the logarithm of the actual
light intensity and interprets the image accordingly.
Consider, for example, a bright light source that is approximately 6times
brighter than another. The eye will perceive the brighter light as
approximately twice the brightness of the darker.

42
Brightness Adaptation and Mach Banding
When viewing any scene:
The eye rapidly scans across the eld of view while coming
to momentary rest at each point of particular interest.
At each of these points the eye adapts to the average
brightness of the local region surrounding the point of
interest.
This phenomena is known as local brightness adaptation.
Mach banding is a visual effect that results, in part, from local
brightness adaptation.
The eye over-shoots/under-shoots at edges where the brightness
changes rapidly. This causes false perception of the intensities
Examples follow.

43
Brightness Adaptation and Mach Banding

44
Brightness Adaptation(Hermann Grid)

45
46
Optical illusion

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Simultaneous Contrast
Simultaneous contrast refers to the way in which two
adjacent intensities (or colors) affect each other.
Example: Note that a blank sheet of paper may appear white
when placed on a desktop but may appear black when used to
shield the eyes against the sun.
Figure 2.9 is a common way of illustrating that the perceived
intensity of a region is dependent upon the contrast of the
region with its local background.
The four inner squares are of identical intensity but are
contextualized by the four surrounding squares
The perceived intensity of the inner squares varies from bright on the
left to dark on the right.

48
Simultaneous Contrast

49
Image Sensing and acquisition

Single sensor

Line sensor

Array sensor

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Image Sensors : Single Sensor

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Image Sensors : Line Sensor

Fingerprint sweep sensor


Computerized Axial Tomography
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Image Sensors : Array Sensor

Charge-Coupled Device (CCD)

w Used for convert a continuous


image into a digital image

w Contains an array of light sensors

w Converts photon into electric charges


accumulated in each sensor unit

CCD KAF-3200E from Kodak.


(2184 x 1472 pixels,
Pixel size 6.8 microns2)
Gate
Vertical Transport Register

Gate

Photosites
Vertical Transport Register
Image Sensor: Inside Charge-Coupled Device

Gate
Horizontal Transportation Register

Vertical Transport Register

Amplifier Output Gate


Output
Image Sensor: How CCD works

i h g Image pixel

f e d

c b a
i h g

f e d
i h g
Horizontal transport
register c b a
f e d

Vertical shift c b a Output

Horizontal shift
Digital Image Acquisition Process

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Generating a Digital Image

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Image Sampling and Quantization

Image sampling: discretize an image in the spatial domain


Spatial resolution / image resolution: pixel size or number of pixels

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
How to choose the spatial resolution

Spatial resolution = Sampling locations


Original image
Sampled image

Under sampling, we lost some image details!


How to choose the spatial resolution : Nyquist Rate

Original image

Sampled image

1mm

2mm

No detail is lost!
Minimum Nyquist Rate:
Spatial resolution
Period Spatial resolution must be less or equal
(sampling rate)
half of the minimum period of the image
or sampling frequency must be greater or
= Sampling locations
Equal twice of the maximum frequency.
Aliased Frequency

x1 (t ) sin( 2t ), f 1
1 x2 (t ) sin( 12t ), f 6
0.5

-0.5

-1
0 0.5 1 1.5 2
Sampling rate:
1
5 samples/sec

0.5

-0.5

-1
0 0.5 1 1.5 2

Two different frequencies but the same results !


Effect of Spatial Resolution

256x256 pixels 128x128 pixels

64x64 pixels 32x32 pixels


Spatial Resolution
It is a measure of the smallest discernible detail in an
image
Can be stated in line pairs per unit distance, and dots(pixels)
per unit distance
Dots per unit distance commonly used in printing and
publishing industry (dots per inch)
Newspaper are printed with a resolution of 75 dpi,
magazines at 133 dpi, and glossy brochures at175 dpi
examples
Effect of Spatial Resolution

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Effect of Spatial Resolution

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Can we increase spatial resolution by interpolation ?

Down sampling is an irreversible process.


(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Image Quantization

Image quantization:
discretize continuous pixel values into discrete numbers

Color resolution/ color depth/ levels:


- No. of colors or gray levels or
- No. of bits representing each pixel value
- No. of colors or gray levels Nc is given by

Nc 2 b

where b = no. of bits


Quantization function

Nc-1

Nc-2
Quantization level

1
0
Light intensity
Darkest Brightest
Intensity Resolution
It refers to the smallest discernible change in intensity
level
Number of intensity levels usually is an integer power of
two
Also refers to Number of bits used to quantize intensity
as the intensity resolution
Which intensity resolution is good for human perception
8 bit, 16 bit, or 32 bit
Effect of Quantization Levels or Intensity resolution

256 levels 128 levels

64 levels 32 levels
Effect of Quantization Levels (cont.)
or Intensity resolution

16 levels 8 levels

In this image,
it is easy to see
false contour.

4 levels 2 levels
How to select the suitable size and pixel depth of images

The word suitable is subjective: depending on subject.

Low detail image Medium detail image High detail image

Lena image Cameraman image

To satisfy human mind


1. For images of the same size, the low detail image may need more pixel depth.
2. As an image size increase, fewer gray levels may be needed.
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Isopreference Curve
Curves tend to become more vertical as the detail in the
image increases
Image with a large amount of detail only a few intensity
levels may be needed
Image Interpolation
Used in image resizing (zooming and shrinking), rotating,
and geometric corrections
Interpolation is the process of using known data to
estimate values at unknown locations
Nearest Neighbor interpolation
It assigns to each new location the intensity of its nearest
neighbor in the original image
Produce undesirable artifacts, such as severe distortion of
straight edges
Bilinear Interpolation
We use the four nearest neighbors to estimate the intensity
V(x, y) = ax + by + cxy + d
Image Interpolation
Need to solve four equations
Better results than nearest neighbor interpolation, with a
modest increase in computational burden
Bicubic Interpolation
Involves sixteen neighbors to estimate intensity

V(x, y) = aij xi yj ( i, j = 0 to 3)
Need to solve sixteen equations
Gives better results than other methods
More complex
Used in Adobe Photoshop, and Corel Photopaint
Basic Relationship of Pixels

(0,0) x

(x-1,y-1) (x,y-1) (x+1,y-1)

(x-1,y) (x,y) (x+1,y)


y

(x-1,y+1) (x,y+1) (x+1,y+1)

Conventional indexing method


Neighbors of a Pixel

Neighborhood relation is used to tell adjacent pixels. It is


useful for analyzing regions.

(x,y-1) 4-neighbors of p:

(x-1,y)
(x-1,y) p (x+1,y)
(x+1,y)
N4(p) = (x,y-1)
(x,y+1)
(x,y+1)

4-neighborhood relation considers only vertical and


horizontal neighbors.

Note: q N4(p) implies p N4(q)


Neighbors of a Pixel (cont.)

(x-1,y-1) (x,y-1) (x+1,y-1) 8-neighbors of p:

(x-1,y-1)
(x-1,y) p (x+1,y)
(x,y-1)
(x+1,y-1)
(x-1,y)
(x-1,y+1) (x,y+1) (x+1,y+1) (x+1,y)
N8(p) = (x-1,y+1)
(x,y+1)
(x+1,y+1)

8-neighborhood relation considers all neighbor pixels.


Neighbors of a Pixel (cont.)

(x-1,y-1) (x+1,y-1) Diagonal neighbors of p:

(x-1,y-1)
p
(x+1,y-1)
ND(p) = (x-1,y+1)
(x+1,y+1)
(x-1,y+1) (x+1,y+1)

Diagonal -neighborhood relation considers only diagonal


neighbor pixels.
Connectivity

Connectivity is adapted from neighborhood relation. Two pixels are connected if they
are in the same class (i.e. the same color or the same range of intensity) and they are
neighbors of one another.

For p and q from the same class


w 4-connectivity: p and q are 4-connected if q N4(p)
w 8-connectivity: p and q are 8-connected if q N8(p)
w mixed-connectivity (m-connectivity):
p and q are m-connected if q N4(p) or
q ND(p) and N4(p) N4(q) =
Adjacency

A pixel p is adjacent to pixel q is they are connected.


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

S1
S2

We can define type of adjacency: 4-adjacency, 8-adjacency


or m-adjacency depending on type of connectivity.
Path

A path from pixel p at (x,y) to pixel q at (s,t) is a sequence


of distinct pixels:
(x0,y0), (x1,y1), (x2,y2),, (xn,yn)
such that
(x0,y0) = (x,y) and (xn,yn) = (s,t)
and
(xi,yi) is adjacent to (xi-1,yi-1), i = 1,,n

q
p

We can define type of path: 4-path, 8-path or m-path


depending on type of adjacency.
Path (cont.)

8-path m-path

p p p

q q q

m-path from p to q
8-path from p to q
solves this ambiguity
results in some ambiguity
Distance

For pixel p, q, and z with coordinates (x,y), (s,t) and (u,v),


D is a distance function or metric if

w D(p,q) 0 (D(p,q) = 0 if and only if p = q)

w D(p,q) = D(q,p)

w D(p,z) D(p,q) + D(q,z)

Example: Euclidean distance

De ( p, q) ( x - s )2 + ( y - t ) 2
Distance (cont.)

D4-distance (city-block distance) is defined as

D4 ( p, q) x - s + y - t

2
2 1 2
2 1 0 1 2

2 1 2

Pixels with D4(p) = 1 is 4-neighbors of p.


Distance (cont.)

D8-distance (chessboard distance) is defined as

D8 ( p, q) max( x - s , y - t )

2 2 2 2 2
2 1 1 1 2
2 1 0 1 2

2 1 1 1 2

2 2 2 2 2

Pixels with D8(p) = 1 is 8-neighbors of p.


89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
Boundary (Border or Contour)
of a region R is the set of points that are adjacent to
points in the complement of R.
of a region is the set of pixels in the region that have at
least one background neighbor.
Inner Border
Outer Border

111
Moire Pattern Effect : Special Case of Sampling

Moire patterns occur when frequencies of two superimposed


periodic patterns are close to each other.

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Human vision: Spatial Frequency vs Contrast
Human vision: Distinguish ability for Difference in brightness

Regions with 5% brightness difference

Вам также может понравиться