Shape Features
shape_features(M)—Returns a matrix of keyed shape-related features, such as centroids and spatial variances and moments, for each distinct pixel value in labeled image M.
The function can be used, along with image morphology and connected component labelling, to classify objects in an image. The image is treated as a connected component image where the components are labeled with consecutive integers, and the features are calculated for each component.
The rows of the resulting matrix correspond to the component labels in the image, and the columns correspond to the calculated features.
The following table describes the column locations of the calculated features:
Column
Feature
0
X centroid
1
Y centroid
2
X direction spatial variance
3
Y direction spatial variance
4
Spatial variance along component's principal axis
5
Spatial variance perpendicular to component's principal axis
6
Area
7
Ratio of the area of the component to the area of the entire image
8
Orientation of the principal axis from horizontal (radians)
9
Eccentricity of the component
10
Leftmost point
11
Rightmost point
12
Uppermost point
13
Lowest point
14
Standard spatial moment 00
15
Standard spatial moment 01
16
Standard spatial moment 10
17
Standard spatial moment 11
18
Standard spatial moment 02
19
Standard spatial moment 20
20
Standard spatial moment 12
21
Standard spatial moment 21
22
Standard spatial moment 03
23
Standard spatial moment 30
24
Central spatial moment 00
25
Central spatial moment 01
26
Central spatial moment 10
27
Central spatial moment 11
28
Central spatial moment 02
29
Central spatial moment 20
30
Central spatial moment 12
31
Central spatial moment 21
32
Central spatial moment 03
33
Central spatial moment 30
34
Normalized central spatial moment 00
35
Normalized central spatial moment 01
36
Normalized central spatial moment 10
37
Normalized central spatial moment 11
38
Normalized central spatial moment 02
39
Normalized central spatial moment 20
40
Normalized central spatial moment 12
41
Normalized central spatial moment 21
42
Normalized central spatial moment 03
43
Normalized central spatial moment 30
44
Invariant moment 1
45
Invariant moment 2
46
Invariant moment 3
47
Invariant moment 4
48
Invariant moment 5
49
Invariant moment 6
50
Invariant moment 7
Arguments
M is an image matrix.
Was this helpful?