Boundary fill algorithm is used frequently in computer graphics to fill a desired color inside a closed polygon having the same boundary color for all of its sides.Boundary Fill Algorithm starts at a pixel inside the polygon to be filled and paints the interior proceeding outwards towards the boundary. This algorithm works only if the color with which the region has to be filled and the color of the boundary of the region are different.
2. INTRODUCTION
• In seed fill algorithm, it has two approaches.
Boundary fill algorithm is one of them.
• Boundary fill algorithm is used frequently in
computer graphics to fill a desired color inside
a closed polygon having the same boundary
color for all of its sides.
• This filling can be done by two techniques-
4-connected pixels
8-connected pixels
2
3. BOUNDARY
FILL
ALGORITHM
First of all take a seed pixel (x, y) inside
the polygon.
Find the neighboring pixels until
boundary is reached.
Seed (x,
y)
3
4. 4 - CONNECTED
In this approach, above, left, right, below pixels
are connected. Areas filled by this method are
called 4-connected neighboring points.
(x, y+1)
(x, y-1)
Seed (x, y)
(x-1, y) (x+1, y)
4
5. 8 - CONNECTED
The pixel on the right, left, above, below and the 4
diagonal pixels. Areas filled by this method are
called 8-connected.
(x, y+1)
(x+1, y+1)
(x+1, y)
(x+1, y-1)
(x, y-1)
(x-1, y-1)
Seed (x,
y)
(x-1, y+1)
(x-1, y)
5
12. BOUNDARY FILL ALGORITHM
4-CONNECTED (EXAMPLE)
But here some problem arise in 4-connected pixels technique,
as shown where we tried to fill the entire region. Here, the
image is filled only partially. In such cases, 4-connected pixels
technique cannot be used. 12