L11 Shape2
L11 Shape2
Dr John Collomosse
[email protected]
3 is the skew of the data (measures how data is “balanced” about mean)
Statistical Moments (2D)
The 2D equation for a moment about zero is:
m10 – x component of mean
m01 – y component of mean
Feature space
H7 H1
H2
In this example, each shape
H3
maps to a point in 7D space H4
H5
H6
H7
Shape descriptor
H6
H5
H4 H3
H2
H1
Shape Descriptors for Classification
H7 H1
H2
H3
H4
H5
H6
H7
Shape descriptor
H6
H5
H4 H3
Feature space
H2
H1
Shape Descriptors for Classification
If we model each class of shape we can build a supervised classifier
• Given a new shape, we calculate it descriptor (point in space) =
• The model it’s nearest to tells us the category of the shape
H7 H1
H2
H3
H4
H5
H6
H7
Shape descriptor
H6
H5
H4 H3
Feature space
H2
H1
Shape Descriptors for Classification
All the supervised classification techniques covered before, apply
here
• Can use Eigenmodels (or even SVMs) to classify
• Use a confusion matrix to evaluate
H7 H1
H2
H3
H4
H5
H6
H7
Shape descriptor
H6
H5
H4 H3
Feature space
H2
H1
Over to You
You win a military contract to design an air defence system
A camera will watch the sky and decide which kind of plane is overhead
( You need to first train the classifier with examples of each class of
plane that needs to be recognised )
Shape Descriptors for Classification
Plane spotting with shape descriptors
Is it a...
Bird?
Plane?
Superman?
H7
BIRD 1.0 0 0
H6
H5 PLANE 0 1.0 0
H4 H3
H2 MAN 0 0.5 0.5
H1
Cleaning up the binary mask
The shape descriptors we have looked at so far are based on regions
Regions are not always cleanly separable from the background
This creates noise in the binary mask
Binary Erosion
A simple form of non-linear filter can help - Erosion
0 0 0 0 1 1
Has speckles
of noise Structuring
0 1 0 0 1 1
Region
0
Element
0 0 1 1 1
1 0 1 1 0 1
Has unwanted holes
0 0 1 1 1 1
0 0 1 1 1 1
0 1 1 1 1 1
Binary Erosion
A simple form of non-linear filter can help - Erosion
0 0 0 0 1 1 0 0 0 0 1 1
0 1 0 0 1 1 0 0 0 0 1 1
0 0 0 1 1 1 0 0 0 1 1 1
1 0 1 1 0 1 Erode 0 0 1 1 0 1
0 0 1 1 1 1 0 0 1 1 1 1
0 0 1 1 1 1 0 0 1 1 1 1
0 1 1 1 1 1 0 1 1 1 1 1
Input Output
0 0 0 0 1 1 0 0 0 0 1 1
0 0 0 0 1 1 0 0 0 0 1 1
0 0 0 1 1 1 0 0 0 1 1 1
0 0 1 1 0 1 Dilate 0 0 1 1 1 1
0 0 1 1 1 1 0 0 1 1 1 1
0 0 1 1 1 1 0 0 1 1 1 1
0 1 1 1 1 1 0 1 1 1 1 1
Input Output
Erode Dilate
Opening
Binary Opening and Closure
These operations illustrate why dilation is not the inverse of erosion
The effect of one does not reverse the other, and this is useful!
Erode Dilate
Opening
Dilate Erode
Closure
Obtaining boundary of a region
A different combination of erosion and dilation can be used here too