Professional Documents
Culture Documents
MATLAB (Image and Video Processing)
MATLAB (Image and Video Processing)
with MATLAB
Dr Thang Ka Fei
Senior Lecturer
School of Engineering
ka.fei@apu.edu.my
Agenda
Introduction
Working with Images/Videos
Image Enhancement
Image Morphology and Segmentation
Case Studies
Image Processing for Engineering
+
Image Addition (Continued)
+
Image Multiplication
*
Image Subtraction
Can you see anything different about the two images?
Image Subtraction (Continued)
Spatial Transformations
B Output image
A Input image
angle Degrees of rotation in the
counterclockwise direction
method Type of interpolation: [{nearest},
bilinear,bicubic]
'crop' Returns only central portion of B, which
is the same size as A.
Image Cropping
Syntax
I2 = imcrop(I,rect)
I2 Output image
I Input image
rect Spatial coordinates of [xmin ymin
width height]
B Output image
A Input image
m Magnification factor
method Type of interpolation: [{bicubic},
bilinear,nearest]
SE Structuring element
shape Flat ['arbitrary' 'pair' 'diamond'
'periodicline ' 'disk' 'rectangle' 'line'
'square' 'octagon']
Nonflat ['arbitrary' 'ball']
parameters Associated with the selected shape
Structuring Element (Continued)
Erosion and Dilation
Erosion
Dilation
Erosion and Dilation (Continued)
BW = BW2 =
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0
0 0 0 1 1 1 1 0 0 0 0 0 1 1 1 1 1 1 0 0
0 0 0 1 1 1 1 0 0 0 0 0 1 1 1 1 1 1 0 0
0 0 0 1 1 1 1 0 0 0 0 0 1 1 1 1 1 1 0 0
0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Example Solution
Blob Analysis
BW Functions
bwarea Returns areas of objects
bwareaopen Removes small objects
bwboundaries Traces region boundaries
bwdist Computes distances between
pixels
bwperim Finds perimeter of objects