Basics of region representation and description Basics of region

Basics of region representation and description
Shape features
Topological
Geometrical
• connected components
• length and diameter of boundary
• numbers of holes
• skeleton
• Euler number
• center of the gravity
• higher order moments
• major and minor axis
• eccentricity
• others
1
Basics of region representation and description
Topological descriptors
• Topological properties are useful for global descriptions of regions in the
image. Topology is the study of properties of a figure that are unaffected
by any deformation, as long as there is no tearing or joining of the figure.
These deformation sometimes are called rubber-sheet distortions
• Number of connected components, number of holes and Euler number
are the invariant topological descriptors.
• For example, Euclidean distance is not a topological feature, since its
value is changing during stretching or shrinking the object. Similarly
perimeter or size of the area
• Topological descriptors, in addition to geometric features, are usually
additional description of the regions in the image
2
Basics of region representation and description
• Connected components C
The area contains three
connected objects C=3
C=1
• Number of holes H
H=1
H=1
H=2
• The Euler number E = C-H
E=0
E=-1
E=1
3
Basics of region representation and description
Skeleton of region
•
•
An important approach to representing the structural shape of a region is to
reduce it to a graph.This can be done by obtaining the skeleton of the region via
a thinning (skeletonizing) algorithm.
The skeleton line can be useful shape feature for character recognition,
inspections of printed circuit boards, image vectorization,etc.
bs=bwmorph(bw,'skel',inf);
4
Basics of region representation and description
• Distance measure on the image
1
– Euclidean distance
1
(x1,y1)
1
1
2
1
2
1
(x1,y1)
1
2
1
2
2
2
2
2
2
2
1
1
1
2
2
1
(x1,y1)
1
2
2
1
1
1
2
2
2
2
2
2
– 4-neighbors distance
– 8-neighbors distance
5
Basics of region representation and description
Geometrical descriptors
• Perimeter - length of the boundary
– For discrete grid, the real length of the edge is not the number of boundary points
1. Perimeter of the object equals the number of elements of the boundary (the simplest
method, but can produce a relatively large error of the estimator)
1
15 14
2
13
3
12
4
11
5
6
10
7
8
9
6
Basics of region representation and description
2. Perimeter of the object is equal to the sum of the segments length connecting
centers of contour pixels. It is assumed that the contour element is a square with
side equal to 1.
This method is more
accurate than the
method with the number
of boundary points
7
Basics of region representation and description
3. Perimeter of the object is determined based on the relationship
– the number of external sides of the contour points
– the number of vertices of the contour
This method provides a length
estimator with zero mean and a
minimum variance for segments
inclined at different angles
8
Basics of region representation and description
• Determination (tracking) of the internal boundary of the region
1.
2.
3.
4.
Search the image rows in sequence until you find the first point of region.
Mark this pixel as P0 (the starting point of the contour). Define the variable
dir storing the previous direction of movement along the boundary (from
the previous to the next point edge).
Assign
dir=3 for 4-neighborhood
dir=7 for 8-neighborhood
Search 3x3 neighborhood of the current pixel rotating counter clockwise
direction starting from
a) for 4- neighborhood:
(dir+3) mod 4
b) for 8- neighborhood:
(dir+7) mod 8 when dir is even number
(dir+6) mod 8 when dir is odd number
The first found point of the region is a new element Pn of the boundary.
Update the value of dir.
If Pn= P1 i Pn-1 =P0, then stop, else go to 2.
Internal boundary is determined by points P0,..., Pn-2
9
Basics of region representation and description
Directions for
1
2
Directions for
3
4-neighborhood
1
8-neighborhood
2
0
4
0
5
7
3
1
3
18 17
2
1
15 14
16 15
2
13
14
3
12
6
13
4
11
7
12
5
10 11
6
4
5
6
8
9
10
7
8
9
10
Basics of region representation and description
• Chain codes
1
2
3
5
3
2
2
3
1
2
4
0
6
7
4
3
1
5
2
1
6
2
0
1
6
2
3
1
7
0
6
3
3
1
4
0
2
2
3
0
0
323303300011112122
2
0
0
0
566760002222344
11
Basics of region representation and description
• Signatures
A signature is a 1-D functional representation of a boundary. Regardless of
how a signature is generated, the basic idea is to reduce the boundary
representation from 2-D to simpler form of 1-D function
– Distance versus angle signatures
[1]
12
Basics of region representation and description
• Statistical moments for digital images
– Geometrical moments of p,q order
- the number of region pixels (area of the object)
- center of gravity coordinates
(position of the object)
– Central moments
13
Basics of region representation and description
– Central moments of order up to 3 with using normal moments
These moments are the basis for determining the 7 moments
invariant to shift, rotation, and scale
14
Basics of region representation and description
• Hu moments (invariant to shift, rotation and scale transformation)
– Normalized central moments
– Hu moments
15
Basics of region representation and description
• Diameter of the boundary B (major axis)
Diameter
The ratio
describes object aspect ratio of the object
is the smallest diameter orthogonal to
• Eccentricity
Eccentricity can be defined as the ratio of the diameter of the object to the
maximum perpendicular diameter (feature invariant to the shift, rotation, and
scale)
- area of the object
16
Basics of region representation and description
• Circularity
Circularity ratio is a measure of the similarity of the shape of the area to the
circle. Circularity is a dimensionless ratio that is also independent of the linear
transformation (shift, rotation, and scale)
17
Basics of region representation and description
• The maximum and minimum radius
The radius
are respectively the longest and shortest radius derived
from the center of gravity of the figure.
The ratio
can be another measure of object aspect ratio
(elongation ratio)
18
Basics of region representation and description
• The minimum circumscribed circle
- number of pixels in the area
19
Basics of region representation and description
• The circumscribed rectangle
The circumscribed rectangle or minimum boundary rectangle - rectangle with the
smallest area that contains the given object, the direction of the longer side of
the rectangle is parallel to the direction of the axis of smallest inertia of the
object
- another ratio of elongation
20
Basics of region representation and description
• Determination of the position and orientation (direction) of objects
– Location of the object on the image can be determined by the coordinates of
the center of gravity of the area
- number of region pixels
– The orientation is defined for the slender objects. As the orientation is
assumed direction of the axis with the smallest inertia (which corresponds to
the direction of the longer side of the circumscribing or basic rectangle)
21
Basics of region representation and description
• Segmentation and counting of object in the image
Edge detection ?
With using erosion
i=imread('circles.png');
in=bwmorph(i,'erode',10);
[il,num]=bwlabel(in);
figure,imshow(in)
disp('Liczba obiektów:');num
22
Basics of region representation and description
– Counting of objects using distance transform
Distance transform is based on addition of intermediate results of the
subsequent erosion of the image
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
1
1
1
1
0
0
0
1
1
1
1
1
0
0
0
1
1
1
1
1
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
1
2
2
1
0
0
0
1
2
2
2
1
0
0
0
1
2
2
1
1
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
1
2
2
1
0
0
0
1
2
3
2
1
0
0
0
1
2
2
1
1
0
0
0
1
1
0
0
0
0
0
0
0
0
0
Example of Distance transform implementation in Matlab
s=[0 1 0; 1 1 1; 0 1 0];
in=uint8(ib);ib=uint8(ib);
for j=1:20
ib=imerode(ib,s);
in=in+uint8(ib);
end
23
Basics of region representation and description
– Example of distance transform for objects counting
Result of distance transform after
histogram stretching
Binarization
24
Basics of region representation and description
– Distance transform and watershed segmentation example
Distance
transform
Watershed
segmentation
25