Binary Image ProcessingIf you have thresholded an image with the goal
in mind of extracting objects in the scene, useful for image analysis tasks, you
can use a number of processing routines to further characterize the object
information in the scene. Below is a series of features that can be detected for
each object region in the image, which we will call B[i][j].
SizeThe area is measured as the number of pixels in the region weighted
by their intensity.
PositionThe equation below calculates the center of the region x,
y.
OrientationTo have a unique orientation along the length of an object,
the object must be elongated in one direction. If this is the case, the axis of
elongation can be used to define the orientation. The axis of least second
moment is equivalent to the axis of least inertia and is used as the axis of
elongation.
The axis of second moment for an object is that line for which the sum of the
sqared distances between the object pixels and the line is minimum.
ProjectionsThe projection of a binary image onto a line can be useful
for segmenting areas along the line for further processing. Consider the task of
trying to find seperation between horizontal lines of text on a page. If you
were to perform a projection along a vertical line, for black text against a
white background the high values of the projection would indicate the line
sperations.
Text image and
vertical projection.
|
Row Sum
grey
0 1400
1 1400
2 1400
3 1400
4 1400
5 1232
6 1316
7 1344
8 980
9 1022
10 1078
11 1036
12 1092
13 1050
14 882
15 1386
16 1358
17 1358
18 1400
19 1400
20 1400
21 1400
22 1400
23 1400
24 1400
25 1400
26 1400
27 1400
28 1400
29 1400
30 1400
31 1400
32 1400
33 1400
34 1400
35 1400
36 966
37 1106
38 1134
39 1148
40 1134
41 1148
42 1148
43 1148
44 1134
45 994
46 1400
47 1400
48 1400
49 1400
|
You can measure various other statistics on an individual blob
Run-Length Encoding, Labeling, Thinning, Morphology (Dilation,
Erosion)See reading assignment on these topics.
Example The binary image and the associated labeled image are
shown below.
binary image
labeled image (give a different label number to each blob detected)
Pseudocoloring is useful here to distinguish connected cells, as the labeled
number of neighboring regions are near each other. The grey scale is poor for
visualizing the individual connected region.
random pseudocolor labeled image
The histogram of the labeled image gives the following information. The
length of the table gives the number of connected regions and its contents gives
the area associated with each region.
# Size: Width = 1, Height = 105, Depth = 1, Time = 1, Elements = 1
0 79409
1 204
2 542
3 795
4 784
5 946
6 242
...
...
...
101 74
102 89
103 95
104 333
So there are 104 connected regions plus the background. Region 1 has 204
pixels, region 104 has 333 pixels.
Mapping the labeled image with the histogram as a colormap, we have:
area display of connected regions
In this resultant image, the value of each pixel is the area of the region
it belongs to.
Dialation and Erosion - 2 Morphological Operators
Dialiation is
to expand the boundary of each blob typically by 1 pixel (you can use other
masks -structuring elements- to expand by)
This can merge 2 nearby blobs.
Erosion is to
shrink the boarder of each blob by 1 pixel. This can eliminate small blobs.
(Again other structuring elements to expand by other than 1 pixel can be
used)
Opening
This is erosion followed by dilation. Instead of growing or shrinking by
a single pixel however, what is called a structuring element
that is a template of some larger size is typically used. For example,
a 3x3 square blob can be used what happens is as follows:
- this means that wherever a pixel in the image can be contained inside
of an overlapped struturing element mask and all of the other pixels inside
of the sturturing element mask are also set to 1, than this pixel is retained
and not eroded. Otherwise, the pixel is eroded.
- The effect of opening can be quite easily visualized. Imagine taking the
structuring element and sliding it around inside each foreground region,
without changing its orientation. All pixels which can be covered by the
structuring element with the structuring element being entirely within the
foreground region will be preserved. However, all foreground pixels which
cannot be reached by the structuring element without parts of it moving
out of the foreground region will be eroded away.
Closing
It is the reverse of Opening. It is defined simply as a dilation followed
by an erosion using the same structuring element for both operations.
Thinning
Similar to Erosion but, preserves blobs (never elminates a blob).
Multiple Algorithms,
see reading and online resources for example algorithsm.
Example Rules in Thinning to think about
One Application of Morphological Operators is in OCR. Doing a few Dialations
followed by Thinning can "connect broken pieces" and then "extract
the skeleton" of characters that a person may write.
On-line Example from http://www1.mmu.edu.my/~mukund/covn/Thin.html
|