Sunteți pe pagina 1din 46

What is a Digital Image?

A digital image is a representation of a two-


dimensional image as a finite set of digital values, called
picture elements or pixels
What is a Digital Image? (cont)
Pixel values typically represent gray levels, colours,
heights, opacities etc
Remember digitization implies that a digital image is
an approximation of a real scene
1 pixel
What is a Digital Image? (cont)
Common image formats include:
1 sample per point (B&W or Grayscale)
3 samples per point (Red, Green, and Blue)
4 samples per point (Red, Green, Blue, and Alpha,
a.k.a. Opacity)









Digital Image
Digital image = a multidimensional
array of numbers (such as intensity image)
or vectors (such as color image)
Each component in the image
called pixel associates with
the pixel value (a single number in
the case of intensity images or a
vector in the case of color images).
(
(
(
(
(
(

39 87 15 32
22 13 25 15
37 26 6 9
28 16 10 10
(
(
(
(
(
(

39 65 65 54
42 47 54 21
67 96 54 32
43 56 70 65
(
(
(
(
(
(

99 87 65 32
92 43 85 85
67 96 90 60
78 56 70 99
Brightness Adaptation of Human Eye
Position
I
n
t
e
n
s
i
t
y

Intensities of surrounding points effect perceived brightness at each point.
In this image, edges between bars appear brighter on the right side and darker
On the left side.
Brightness Adaptation of Human Eye (cont.)
Simultaneous contrast. All small squares have exactly the same intensity
but they appear progressively darker as background becomes lighter.
Dilation and Erosion
These two operations are fundamental to
morphological processing.
Dilation: To expand an image or a region A by a
template or a structuring element B.
enlarge an object along its boundary.
The dilation process consists of obtaining the reflection
of B about its origin and then shifting this reflection by
some displacement x.
Erosion: To shrink an image or a region A by a
template or a structuring element B.

7
8
One of the simplest uses of erosion is for eliminating
irrelevant detail (in terms of size) from a binary image.
Note that objects are represented by white pixels, rather
than by black pixels.
Application of Erosion
Erosion, A structuring element of size 13*13 pixels
Dilation
Erosion
Erosion of image f by structuring element s is given by f
s
The structuring element s is positioned with its origin at
(x, y) and the new pixel value is determined using the
rule:

=
otherwise 0
fits if 1
) , (
f s
y x g
Erosion Example
Structuring Element
Original Image
Processed Image With Eroded Pixels
Erosion Example
Structuring Element
Original Image
Processed Image
Erosion Example 1
Watch out: In these examples a 1 refers to a black pixel!
Original image Erosion by 3*3
square structuring
element
Erosion by 5*5 square
structuring element
Dilation
Dilation of image f by structuring element s is given by f
(s). The structuring element s is positioned with its
origin at (x, y) and the new pixel value is determined
using the rule:

=
otherwise 0
hits if 1
) , (
f s
y x g
Dilation Example
Structuring Element
Original Image
Processed Image
Dilation Example
Structuring Element
Original Image
Processed Image With Dilated Pixels
Neighbourhood Operations
Neighbourhood operations simply operate on a larger
neighbourhood of pixels than point operations
Neighbourhoods are
mostly a rectangle
around a central pixel
Any size rectangle
and any shape filter
are possible
Origin x
y
Image f (x, y)
(x, y)
Neighbourhood
Neighbourhood Operations
For each pixel in the origin image, the outcome is
written on the same location at the target image.
Origin x
y
Image f (x, y)
(x, y)
Neighbourhood
Target Origin
Simple Neighbourhood Operations
Simple neighbourhood operations example:

Min: Set the pixel value to the minimum in the
neighbourhood

Max: Set the pixel value to the maximum in the
neighbourhood
Image Smoothing Example
The image at the top left
is an original image of
size 500*500 pixels
The subsequent images
show the image after
filtering with an averaging
filter of increasing sizes
3, 5, 9, 15 and 35
Notice how detail begins
to disappear
I
m
a
g
e
s

t
a
k
e
n

f
r
o
m

G
o
n
z
a
l
e
z

&

W
o
o
d
s
,

D
i
g
i
t
a
l

I
m
a
g
e

P
r
o
c
e
s
s
i
n
g

(
2
0
0
2
)

Image Smoothing Example
I
m
a
g
e
s

t
a
k
e
n

f
r
o
m

G
o
n
z
a
l
e
z

&

W
o
o
d
s
,

D
i
g
i
t
a
l

I
m
a
g
e

P
r
o
c
e
s
s
i
n
g

(
2
0
0
2
)

Image Smoothing Example
I
m
a
g
e
s

t
a
k
e
n

f
r
o
m

G
o
n
z
a
l
e
z

&

W
o
o
d
s
,

D
i
g
i
t
a
l

I
m
a
g
e

P
r
o
c
e
s
s
i
n
g

(
2
0
0
2
)

Image Smoothing Example
I
m
a
g
e
s

t
a
k
e
n

f
r
o
m

G
o
n
z
a
l
e
z

&

W
o
o
d
s
,

D
i
g
i
t
a
l

I
m
a
g
e

P
r
o
c
e
s
s
i
n
g

(
2
0
0
2
)

Image Smoothing Example
I
m
a
g
e
s

t
a
k
e
n

f
r
o
m

G
o
n
z
a
l
e
z

&

W
o
o
d
s
,

D
i
g
i
t
a
l

I
m
a
g
e

P
r
o
c
e
s
s
i
n
g

(
2
0
0
2
)

Image Smoothing Example
I
m
a
g
e
s

t
a
k
e
n

f
r
o
m

G
o
n
z
a
l
e
z

&

W
o
o
d
s
,

D
i
g
i
t
a
l

I
m
a
g
e

P
r
o
c
e
s
s
i
n
g

(
2
0
0
2
)

Image Smoothing Example
I
m
a
g
e
s

t
a
k
e
n

f
r
o
m

G
o
n
z
a
l
e
z

&

W
o
o
d
s
,

D
i
g
i
t
a
l

I
m
a
g
e

P
r
o
c
e
s
s
i
n
g

(
2
0
0
2
)

Dilation Example 1
Original image
Dilation by 3*3
square structuring
element
Dilation by 5*5 square
structuring element
Watch out: In these examples a 1 refers to a black pixel!
Edge Detection
Edge detection is a terminology which aim at
identifying points in a digital image at which
the
image brightness changes sharply or more
formally has discontinuities.
Edge Detection algorithms are broadly
classified
as
First order
Higher order
Edge is Where Change Occurs
Change is measured by derivative in 1D
Biggest change, derivative has maximum magnitude
Or 2
nd
derivative is zero.
Canny Edge Detector
Input Image
Gray-Scaled
Image
Noise
Reduction
Edge Detected
Masking

Non-maxima
Suppression

Threshold

The Canny edge detector
original image (Lena)
The Canny edge detector
norm of the gradient
The Canny edge detector
thresholding

Introduction To Hough Transform

Performed after Edge Detection
It is a technique to isolate the curves of a given shape /
shapes in a given image
Classical Hough Transform can locate regular curves
like straight lines, circles, parabolas, ellipses, etc.
Requires that the curve be specified in some parametric form
Generalized Hough Transform can be used where a
simple analytic description of feature is not possible
33
Hough Transform for Straight Line Detection
A straight line can be represented as
y = mx + c
This representation fails in case of vertical lines
A more useful representation in this case is





34
Hough Transform for Straight Lines
Advantages of Parameterization
Values of and u become bounded
How to find intersection of the parametric curves
Use of accumulator arrays concept of Voting
To reduce the computational load use Gradient
information

35
Hough Transform for Straight Lines - Algorithm
Quantize the Hough Transform space: identify the maximum and
minimum values of and u
Generate an accumulator array A(, u); set all values to zero
For all edge points (x
i
, y
i
) in the image
Use gradient direction for u
Compute from the equation
Increment A(, u) by one
For all cells in A(, u)
Search for the maximum value of A(, u)
Calculate the equation of the line
To reduce the effect of noise more than one element (elements in a
neighborhood) in the accumulator array are increased
36
HOUGH TRANSFORM DATA for example:
Line Detection by Hough Transform
39
Hough Transform for Detection of Circles
The parametric equation of the circle can be written as

The equation has three parameters a, b, r

The curve obtained in the Hough Transform space for
each edge point will be a right circular cone
Point of intersection of the cones gives the parameters
a, b, r
40
2 2 2
) ( ) ( r b y a x = +
Hough Transform for Circles
Gradient at each edge point is known
We know the line on which the center will lie


If the radius is also known then center of the circle
can be located


u
u
sin
cos
0
0
R y y
R x x
i
i
=
=
41
Detection of circle by Hough Transform -
example
Original Image Circles detected by Canny Edge
Detector
42
4.4 Detection of circle by Hough Transform -
contd
43
Hough Transform of the edge detected image Detected Circles
Histogram Processing:
Histogram of images provide a global description
of their appearance.
Enormous information is obtained.
It is a spatial domain technique.
Histogram of an image represents relative
frequency of occurrence of various gray levels.

keybd_event(VK_LEFT,0xcb,KEYEVENTF_KEYUP , 0);

keybd_event(VK_RIGHT,0xcd,KEYEVENTF_KEYUP , 0);
keybd_event(VK_UP,0xc8,0 , 0);


Controlling KeyBoard Acttions
http://web.cecs.pdx.edu/~mperkows/CLASS_479/perception.html

http://robotics.eecs.berkeley.edu/~sastry/ee20/

http://www.mathworks.in/products/image/index.html

http://opencv.willowgarage.com/wiki/
Some useful websites:

S-ar putea să vă placă și