Image Processing
Image Processing
TO
IMAGE PROCESSING
1
COMPUTER VISION
• Computer vision is a field that includes methods for
• acquiring
• processing
• analyzing
• understanding images
• In general, high-dimensional data from the real world in order to
produce numerical or symbolic information, e.g., in the forms of
decisions.
• A theme in the development of this field has been to duplicate the
abilities of human vision by electronically perceiving and
understanding an image
2
RELATED FIELDS
3
WHAT IS MACHINE VISION?
• Machine vision is the technology and methods used to
provide imaging-based automatic inspection and
analysis for such applications as automatic inspection,
process control, and robot guidance in industry.
4
WHAT IS DIGITAL IMAGE PROCESSING?
• A image may be defined as two-dimensional function, f(x, y).
• Where x and y are spatial coordinates.
• The value at any pair of coordinates of f(x, y) is called as intensity
or gray level.
• These elements are called PIXEL elements.
• Enhancing an image
• Extracting information features from an image.
• Pattern recognition
5
6
7
TYPES OF IMAGES
• Binary image
• Color image
8
BINARY IMAGE
9
GRAY IMAGE
10
COLOR IMAGE
11
ROLE OF IMAGE PROCESSING
• Improvement of pictorial information for Human interpretation
• Enhance the contrast levels for easier interpretation of X-ray
images
• Removing the noise from aerial and satellite imagery
• Processing scene of data for autonomous machine perception
• Character recognition(OCR,OCV)
• Machine Vision system for assembly and inspection
• Fingerprint processing
12
COORDINATE CONVENTION
13
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
14
IMAGE ACQUISITION
Image Morphological
Restoration Processing
Image
Segmentation
Enhancement
Image Object
Acquisition Recognition
Representation
Problem Domain Colour Image Image & Description
Processing Compression
15
IMAGE ENHANCEMENT
Image Morphological
Restoration Processing
Image
Segmentation
Enhancement
Image Object
Acquisition Recognition
Representation
Problem Domain
& Description
Colour Image Image
Processing Compression
16
IMAGE RESTORATION
Image Morphological
Restoration Processing
Image
Segmentation
Enhancement
Image Object
Acquisition Recognition
Representation
Problem Domain
& Description
Colour Image Image
Processing Compression
17
MORPHOLOGICAL PROCESSING
Image Morphological
Restoration Processing
Image
Segmentation
Enhancement
Image Object
Acquisition Recognition
Representation
Problem Domain
& Description
Colour Image Image
Processing Compression
18
SEGMENTATION Image Morphological
Restoration Processing
Image
Segmentation
Enhancement
Image Object
Acquisition Recognition
Representation
Problem Domain
& Description
Colour Image Image
Processing Compression
19
OBJECT RECOGNITION:
Image Morphological
Restoration Processing
Image
Segmentation
Enhancement
Image Object
Acquisition Recognition
Representation
Problem Domain
& Description
Colour Image Image
Processing Compression
20
REPRESENTATION & DESCRIPTION
Image Morphological
Restoration Processing
Image
Segmentation
Enhancement
Image Object
Acquisition Recognition
Representation
Problem Domain
& Description
Colour Image Image
Processing Compression
21
IMAGE ACQUISITION….
Lighting
device
object
Camera
22
FACTORS AFFECTING LIGHTING
• Lighting device
• Test object
• Lighting environment
23
ARRANGEMENT OF LIGHTING
• Incident Light
• Needs incident light reflections or at least scattering of the test object for
imaging.
• Transmitted light
• Positioned at the opposite side of the object plane.
• Creates sharp and good contrast for low opaque or low transparent parts.
24
FACTORS FOR BUILDING MACHINE VISION
SYSTEMS
• Camera scan type
• FOV
• Resolution
• Lens
• Illumination
• Electrical and Mechanical interfaces
• Designing and choosing software
25
CAMERA PARAMETERS
26
CONSIDERATION FOR IMAGE ACQUISITION
• Choosing CAMERA
• Field of view
• Resolution
• Lens
• Lighting source
• Designing and choosing Software
• MATLAB
• Halcon
• openCV
27
SIGNAL FLOW OF IMAGE FROM CAMERA TO COMPUTER (ANALOG)
Vision Camera
Frame Grabber
Analog Signal
RS 170 / CCIR
28
SIGNAL FLOW OF IMAGE FROM CAMERA TO COMPUTER (DIGITAL)
Vision Camera
Frame Grabber
Digital Signal
MAY BE, or
becomes a
part of the
camera
30
LIGHT SOURCES
• Incandescent Lamps
• Halogen Lamps
• Metal vapour lamps Halogen
Incandescent
• Xenon lamps
• Fluorescent lamp
• Light emitting diode LED Fluorescent
• Lasers
LED
Xenon
31
LIGHTING COMPONENT
32
33
IMAGE ENHANCEMENT
Image Morphological
Restoration Processing
Image
Segmentation
Enhancement
Image Object
Acquisition Recognition
Image Representation
Problem Domain Colour Image
Compression & Description
Processing
34
IMAGE ENHANCEMENT…
• It is performed to remove unwanted clutter or noise
from an image.
• Process of adjusting digital images so that the results
are more suitable for display or further analysis.
• Technique used to improve the quality of an image.
• Enhance Information
35
ENHANCEMENT TECHNIQUES
Histogram
Gray level stretching
Processing
Image averaging
Filtering
Image Subtraction
36
HISTOGRAM PROCESSING
• An image histogram is a chart that shows the
distribution of intensities in an indexed or grayscale
image.
• You can use the information in a histogram to choose
an appropriate enhancement operation.
• For example, if an image histogram shows that the
range of intensity values is small, you can use an
intensity adjustment function to spread the values
across a wider range.
37
HISTOGRAM FOR DIFFERENT CONTRAST
• It is the probability of occurrence associated with the gray levels
in the range 0 to 255.
38
GRAY SCALE STRETCHING
• Gray scale stretching is achieved by first shifting all the values so that
the actual pixel grey-level range begins at 0.
• Add to every pixel the difference between the final low value(0) and
the initial low value(100): 0-100= -100
39
CONTD….
• Next , we scale everything, reassigning values in the range 0 – 100 to
the range 0 – 255 i.e we scale by a factor = (255-0)/(100-0) = 2.55
• Thus, in this instance, to stretch the contrast so that all the grey-scale
are utilized, one must simply apply the following operation.
40
MORPHOLOGY
• Used for shape and structural manipulations. Can be done in binary
or grayscale images.
• Neighborhood operator that determines each pixel value according to
its geometrical relationship to its neighbors.
• Morphological operator can:
• Thin
• Thicken
• Fill
41
STRUCTURING ELEMENT
• The operations of binary morphology input a binary image B and
structuring element S.
• S is another binary image or sub image.
• It represents a shape, can be of any size and have arbitrary structure that
can be represented by a binary image and depend on application.
• Members and origin of SE are specified.
• A symmetrical one will enlarge or shrink the original set in all directions.
• A vertical one, will only expand or shrink the original set in the vertical
direction.
42
STRUCTURING ELEMENT
43
BASIC MORPHOLOGICAL OPERATIONS
• The basic morphological operations of binary morphology are
dilation, erosion, closing, and opening.
Dilation enlarges a region.
Erosion makes a region smaller.
A closing operation can close up internal holes on a region and
eliminate bays along boundaries.
An opening operation can get rid of small portions of the region that
run out from the boundary.
44
DILATION
• Can be though of as rolling a
1 2
ball along the edge and adding
4 3
pixels where it fits.
• Any pixel that has one or
more of its neighbors white is
turned to white.
Dilate
45
DILATION
+
• Dilation of set B by structuring element S
• New set C=B S is composed of all the points obtained by replacing
every point(x , y) in B with a copy of S , placing the origin point(0,0)of
S at (x , y). The replacement operation works vice versa.
S
Dilating B with a 3X3
structuring element S of
ones, centered at origin
46
DILATION
• Dilate a binary image with a vertical line structuring element.
47
EROSION
• Can be thought of as peeling away layers ,like onion
• Any pixel whose neighborhood is not entirely white is turned black.
1 2
4 3
48
EROSION
• Erosion of set B by structuring element S
• New set C=B S is composed of all the points (x , y) for which S is in B.
This can be done by moving S over B ,find all the places it will fit
completely, and for each such place, mark down the point
corresponding to the origin(0 , 0) point of S.
Eroding B with a 3X3 S
structuring element S of
ones, centered at origin
49
EXAMPLES
50
OPENING
• Opening is erosion followed by dilation
51
CLOSING
• Closing is dilation followed by erosion
52
RGB COLOR SPACE
RGB color image is an MxNx3 array of color pixels , where M, N is
row, column and 3 represents three monochromatic images (R,G,B)
combined to form an RGB color image.
The color image would have 24 bit/pixel – 8 bit for each color bands
(red, green and blue )
53
RGB COLOR SPACE
54
COLOR IMAGES
R M B
W
Y C
55
CONTD…
G
B
G
B
R R+G+ R R+G+
B B
B B
G G
R R+G+ R R+G+
B B
B B
G G
R R+G+ R R+G+
B B
56
HSV COLOR SPACE
• The color space other than HSV is not well suited for
describing colors in terms that are practical for
human interpretation.
57
HSV SPACE
HUE:
• It describes pure color which distinguish red, green, yellow.
• More than 400 hues can be seen by humans.
SATURATION:
• It is measure of a degree to which a pure color is diluted by white light.
• A pure color has 100% saturation and the white ,black have 0% saturation. About 20
saturation levels are visible per hue.
VALUE:
• The average of three layers.
58
CONTD…
Var=rgb2hsv(‘rgb.jpg’);
Hue =Var(:,:,1);
Sat =Var(:,:,2);
Val =Var(:,:,3);
59