Sei sulla pagina 1di 25

Copyright Robotix Team, IIT Kharagpur

February 1st 4th ,2007


Copyright Robotix Team, IIT Kharagpur

What is Image Processing
Image Processing is a tool for analyzing image
data in all areas of natural science.
It is concerned with extracting data from real-
world images.
Differences from computer graphics is that
computer graphics makes extensive use of
primitives like lines, triangles & points. However
no such primitives exist in a real world images.
Copyright Robotix Team, IIT Kharagpur

Typical Applications of IP
Automated visual inspection system. Checking of
objects for defects visually.
Satellite Image Processing.
Classification (OCR), identification (Handwriting,
finger prints) etc.
Copyright Robotix Team, IIT Kharagpur

Components of IP system
Camera, Scanner, other image acquisition
software.
PC or workstation or DSP kit.
Software to run on the hardware platform.
To process an image, a representation or model
is necessary.
An image is a spatial distribution of irradiance in
a plane.
Copyright Robotix Team, IIT Kharagpur

Possible representation of Images
Matrix
Quadtrees
Chains
Pyramid
Of the four, matrix is the most general. The other
three are used for special purposes. All these
representations must provide for spatial
relationships.
Copyright Robotix Team, IIT Kharagpur

Matrix Representation
Computers cannot handle continuous images but
only arrays of digital numbers.
So images are represented as 2-D arrays of
points (2-D matrix)
A point on this 2-D grid (corresponding to the
image matrix element) is called PIXEL (picture
element)
It represents the average irradiance over the
area of the pixel.
Copyright Robotix Team, IIT Kharagpur

Types of Images
Color Images :
Each pixel value has three components. Red,
Green, Blue. Each component can take a value of
0-255. In computer memory it is stored as a 32
bit value with bits 0-7 storing Blue, 8-15 storing
Green, 16-23 storing Red, 24-31 storing alpha or
left blank.
Copyright Robotix Team, IIT Kharagpur

Types of Images(contd..1)
Grey Scale Images :
Each Pixel value has only one component,
Grayscale value. This represents the brightness
on a 0-255 scale. It is also stored in memory as
32 bit with
R=G=B. But for our purposes we can use a
single uchar and convert it to ulong on the fly.
Copyright Robotix Team, IIT Kharagpur

Types of Images(contd..2)
Binary Images :
Each pixel can take one of the two values 0 and 1.
so a pixel is either ON or OFF. Images which are
easiest to work with
We recommend using these Images.
Copyright Robotix Team, IIT Kharagpur

Concept of Neighbourhoods
A Neighbourhood N of a pixel is a subset of the
image which satisfies some distance relation with
the pixel.
Euclidean distance
L
euclidean
= (x
1
-y
1
)
2
+(x
2
-y
2
)
2
City Block distance
L
city
= |(x
1
-y
1
)|+|(x
2
-y
2
)|
Chess board distance
L
chessboard
= min (|x
1
-y
1
|, |x
2
-y
2
|)
Copyright Robotix Team, IIT Kharagpur

Concept of Neighbourhoods(contd)
Von Neumann Neighbourhood
Nvon(x) = { y : Lcity (y,x) =1)
Moore Neighbourhood
Nmoore(x) = {y : Lchess(y,x) =1 )



Copyright Robotix Team, IIT Kharagpur

Image Preprocessing
First step in most IP applications.
Used to remove noise in the input image
Examples are median filtering, averaging,
contrast enhancement etc.
Copyright Robotix Team, IIT Kharagpur

Image Preprocessing(contd)
Median Filtering
F is an image.
F is an blank image.

F(x) = Median {F(y)| y N(x) }
x=(x1,x2) , y= (y1,y2)
F(x) = Median(F(x,y+1),F(x,y-1),F(x-1,y),F(x,y-1))
Mean Filtering
F(x) = Mean {F(y)| y N(x) }

F(x) = (F(x,y+1),F(x,y-1),F(x-1,y),F(x,y-1))
Copyright Robotix Team, IIT Kharagpur

Image Preprocessing(contd)
Edge Detection
Almost all edge detection algorithms are based on
some form of differentiation.

Simplest Algorithm:
F(x
1
,x
2
) = F(x
1
+1,x
2
) F(x
1
,x
2
) Horizontal Gradient

Copyright Robotix Team, IIT Kharagpur

Image Preprocessing(contd)
F(x
1
,x
2
) = F(x
1
,x
2
+1) F(x
1
,x
2
) Vertical Gradient

F(x
1
,x
2
) = |F(x
1
+1,x
2
) F(x
1
,x
2
)|+
|F(x
1
,x
2
+1) F(x
1
,x
2
)|
Other Possible algorithms: Sobel, canny, Frei-Chen,
Crack, Roberts, Prewitt etc.

Copyright Robotix Team, IIT Kharagpur

Segmentation:

The process of checking each individual pixel to
see whether it belongs to an object of interest or
not.
After segmentation, it is known which pixel
belongs to which object.
The next step is image analysis & recognition,
using the shape of the image.
Copyright Robotix Team, IIT Kharagpur

Segmentation(contd)
Simplest Segmentation: Pixel Based

if (F(x)>T)
F(x)=1 else
F(x)=0.
Where F(x) is a gray scale image and F(x) is a
binary image of same dimensions.
Copyright Robotix Team, IIT Kharagpur

Segmentation(contd)
Connected Components segmentation.
Let a be a binary image of mxn.
Let b, c, d be normal real valued images.
Algo: Let d (i, j) = i*n+j 0 I m-1, 0 j n
Let b=0
c=d.a
While b!=c
b=c
c=(b
^
N).a
end
Copyright Robotix Team, IIT Kharagpur

Segmentation(contd)
Selecting the threshold
Usually selected interactively.
If is the mean & is the variance of all the pixel
values.
Then +k (1k 3) gives good results. Where
the background is much larger than the object.
Other methods of dynamic thresholding exist.
Copyright Robotix Team, IIT Kharagpur

Morphology
Operations on the size and shape of the object.
Performed on binary images

Copyright Robotix Team, IIT Kharagpur

Basic Operations
Erosion
G-M ={ p: M
p
c= G }
G: Set of all pixels of the matrix which are non
zero.
M
p
: Neighbourhood operator centered at point P
(here called a structuring element)
Copyright Robotix Team, IIT Kharagpur

Basic Operations(contd)
Dilation
G+M ={ p: M
p
G }
Elementary operators from which other more
complex operators can be built.
Although they belong to the family of the image
analysis operators, it can also be used as low
operator to remove noise.

Copyright Robotix Team, IIT Kharagpur

Basic Operations(contd)
Composite Morphological Operators
Opening
G

M = (G M ) + M
Closing
G M = (G + M) M
Salt and Pepper Noise Removal
(G

M) M.
Copyright Robotix Team, IIT Kharagpur

Opening removes all objects which at no point
completely enclose the structure element, but it
does not shrink the objects which are larger than
the dia of the structuring element.
Ideal for removing thin lines.
Closing operator closes small holes and cracks
without general enlargement.
Basic Operations(contd)
Copyright Robotix Team, IIT Kharagpur

Thank you

Potrebbero piacerti anche