Image Processing Reference
In-Depth Information
Fig. 7.1 ( a ) A binary image
containing different shapes.
( b ) A binary image
containing a human and some
noise
Fig. 7.2 4- and
8-connectivity. The effect of
applying the two different
types of connectivity
7.1.1 The Recursive Grass-Fire Algorithm
The algorithm starts in the upper-left corner of the binary image. It then scans the
entire image from left to right and from top to bottom, as seen in Fig. 4.28.
At some point during the scan an object pixel (white pixel) is encountered and
the notion of grass-fire comes into play. In the binary image in Fig. 7.3 the first
object pixel is found at the coordinate ( 2 , 0 ) . At this point you should imagine your-
self standing in a field covered with dry grass. Imagine you have four arms (!) and
are holding a burning match in each hand. You then stretch out your arms in four
different directions (corresponding to the neighbors in the 4-connectivity) and si-
multaneously drop the burning matches. When they hit the dry grass they will each
start a fire which again will spread in four new directions (up, down, left, right) etc.
The result is that every single straw which is connected to your initial position will
burn. This is the grass-fire principle. Note that if the grass field contains a river the
grass on the other side will not be burned.
Returning to our binary image, the object pixels are the “dry grass” and the non-
object pixels are water. So, the algorithm looks in four different directions and if it
finds a pixel which can be “burned”, meaning an object pixel, it does two things.
Search WWH ::




Custom Search