Beruflich Dokumente
Kultur Dokumente
Presents
ENDEAVOUR
(Workshop Series)
It all begi
ns here!!!
:)
Workshop
on
Image Processing
using MATLAB
Motivation
Machine Learning
Real Time Image Processing
MATrix
MATLA
B
LABorator
y
MATLAB
A Fourth Generation Programming
Language
OOP
Machine
Learning
Algos and
Numerical
Computing
Signal
Processin
g
Simulatio
n
Computer
Vision
DSP
Mathematical
Models
3D Animation
Workspace
Command
Window
Current
Directory
Command
History
Basics of MATLAB
Variable
s
Creatin
g
Arrays
Indexin
g
Of
Arrays
Operatio
ns
On
Arrays
Function
s
Control
Flow
Variable
s
Creatin
g
Arrays
Indexin
g
Of
Arrays
Operatio
ns
On
Arrays
Function
s
Control
Flow
Variables
Variable
s
Creatin
g
Arrays
Indexin
g
Of
Arrays
Operatio
ns
On
Arrays
Function
s
Control
Flow
Creating Arrays
Commas or spaces! Both
will do!
Semi colon is used to suppress
output
Variable
s
Creatin
g
Arrays
Indexin
g
Of
Arrays
Operatio
ns
On
Arrays
Function
s
Control
Flow
Indexing of Arrays
Observe that the first
element is (1,1) and not
(0,0)
Variable
s
Creatin
g
Arrays
Indexin
g
Of
Arrays
Operatio
ns
On
Arrays
Function
s
Control
Flow
Operations on Arrays
Array + Array
Array - Array
Array * Array
Element wise multiplication??
Array - Scalar
Array * Scalar
Element-wise
multiplication..??
Array / Scalar
Variable
s
Creatin
g
Arrays
Indexin
g
Of
Arrays
Operatio
ns
On
Arrays
Function
s
Control
Flow
Functions
To open the editor
File -> New -> Script
Ctrl + N
New Blank File Icon
Function header syntax:
function [output variables] = function_name
(input_variables)
eg.
function[sum, product] = operations(A, B)
Functions (Contd.)
Variable
s
Creatin
g
Arrays
Indexin
g
Of
Arrays
Operatio
ns
On
Arrays
Function
s
Control
Flow
Variable
s
Creatin
g
Arrays
Indexin
g
Of
Arrays
Operatio
ns
On
Arrays
Function
s
Control
Flow
A Few Commands
A Few Functions
Trigonometric: sin(), sind(), cos(), cosd(), etc
Inverse trigonometric: asin(), asind(), acos(),
acosd(), etc
min(), max()
size()
sort()
zeros()
ones()
eye()
Try these..!!
!
s
c
i
s
a
B
D
f
:
o
!
!
h
s
g
e
u
g
o
a
n
m
E
I
,
e
y
l
l
m
a
o
s
Fin
e
v
a
h
s
t
e
L
Images
Black
and
White
(Binary
)
Gray
scale
Colour
Images in MATLAB
Each image is seen as a
Images in MATLAB
(Contd.)
Binary
Gray
scale
RGB
imread()
imshow()
imtool()
imcrop()
PreProcessi imresize()
ng
Analysi
Processi
ng
Morphological Operations
Contrast Enhancement
Histogram Equalization
Image Smoothing
Blurring
imread()
imshow()
imtool()
imcrop()
PreProcessi imresize()
ng
Analysi
Processi
ng
Basics
imread(): Reads
the image as a
matrix
imshow(): Shows
the image as an
image
imtool(): Same as
imread()
imshow()
imtool()
imcrop()
PreProcessi imresize()
ng
Analysi
Processi
ng
Morphological Operations
Contrast Enhancement
Histogram Equalization
Image Smoothing
Blurring
Pre-Processing
imcrop():
imcrop(im) : Interactive crop tool
imcrop(im, [x1,y1,x2,y2])
imresize():
imresize(im, 0.5)
imresize(im, [200, 200])
imresize(im, [200, NaN] )or imresize(im, [NaN,
200] )
imresize(im, 0.5, nearest) or imresize(im, 0.5,
bilinear) or imresize(im, 05, bicubic)
imread()
imshow()
imtool()
imcrop()
PreProcessi imresize()
ng
Analysi
Processi
ng
Conversion to Binary
(stay
Why converting?
Less information in binary => Computational
Ease
Can focus on only the area of interest
Most of the analysis can be done on Binary only
im2bw(): This
function converts a
RGB image
to a binary image
imtool(bw);
L-matrix labels
image.
>>B=bwboundaries(bw)
Returns B, a P-by-1 cell array, where P is the
More about
bwboundaries()
In the coordinate matrix, the first coordinate is the row number (y
- coordinate) and second coordinate is the column number (xcoordinate) of the boundary pixel. Take this always into
consideration as it can create a lot of confusion.
option is to use
bwboundaries(bw,'noholes')
regionprops()
It is used to measure properties of image regions like
STATS=regionprops(L, properties);
STATS is a structure array of length equal to the number of
labelled objects in L.
properties to be measured.
imread()
imshow()
imtool()
imcrop()
PreProcessi imresize()
ng
Analysi
Processi
ng
Morphological Operations
Contrast Enhancement
Image Smoothing
Image Blurring
Morphological
Operations
imerode()
imdilate()
imopen()
imclose()
imfill()
bwmorph(
)
bwperim()
Piyush- 7752957837
Arshiyan 8418950295
Sairam- 9479450482
Saloni- 7408843517
Contrast Enhancement
imhist(): Returns the histogram of a gray
scale image.
imadjust()
histeq()
adapthisteq()
Thresholding
Global Threshold
Thresholding (Contd.)
Adaptive
Thresholding:
This works by
thresholding on
smaller tiles of
the image.
What is applying a
Filter??
The following figure shows how
to compute the (2,4) output
pixel
Implementation in
MATLAB
A Use of Blurring:
Median Filter
Just as a note, the blurring results in loss of
B = medfilt2(A, [m n])
Demo:
Unsharp Mask
oMask
corresponding to a
derivative:
[ 0 0 0;
0 -1 1;
0 0 0;]
Unsharp Mask
Mask corresponding to a derivative:
[ 0 0 0;
0 -1 1;
0 0 0;]
Mask corresponding to a
double derivative:
[ 0 0 0;
1 -2 1;
0 0 0;]
Edge Detection
BW = edge(I) takes a grayscale or a binary image I
DEMO
Detecting a Cell Using Image segemtation
Watershed Segmentation
HOUGH TRANSFORM