0% found this document useful (0 votes)
91 views7 pages

Boundary Fill - Lect - 09

This document discusses two techniques for object filling in images: boundary fill and flood fill. Boundary fill works by examining neighboring pixels of a seed pixel to fill the area inside an object's boundary. It can be done via four-connected or eight-connected pixel examination. Flood fill works similarly but fills the entire area connected to the seed pixel rather than stopping at boundaries.

Uploaded by

bhuj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
91 views7 pages

Boundary Fill - Lect - 09

This document discusses two techniques for object filling in images: boundary fill and flood fill. Boundary fill works by examining neighboring pixels of a seed pixel to fill the area inside an object's boundary. It can be done via four-connected or eight-connected pixel examination. Flood fill works similarly but fills the entire area connected to the seed pixel rather than stopping at boundaries.

Uploaded by

bhuj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 7

CSL582

Object Filling
What is Object Filling

•Set of pixels surrounded by boundary known as object.


•To set the colour inside of object known as object filling.
•To implement the object filling we have to major techniques –
1. Boundary Fill / Seek Fill
2. Flood Fill

To implement these techniques we have to methods. These are


a. Four Way Connected
b. Eight Way Connected
a. Four Connected

•It is the first implementation technique which help to fill the object in four direction at
once.
•It create 4 pixel in four direction at once which is fast technique but have some issues.
a. After set colour in four direction some of direction are un-used.
b. The output is not as good as.
2. Eight Connected

•It is design to solve the problem of 4 connected approach.


•This implementation technique help to fill the object in Eight direction at once.
•It create 8 pixel in eight directions at once which is fast technique and also use every
corner of object to fill.
•It Provide better output then four connected approach.
1. Boundary Fill

•The first method that introduce the concept to fill the object.
•In this method, edges of the polygons are drawn. Then starting with some seed, any point
inside the polygon we examine the neighboring pixels to check whether the boundary
pixel is reached.
•If boundary pixels are not reached, pixels are highlighted and the process is continued
until boundary pixels are reached.
•We can two procedures
a. Boundary fill using Four Connected
b. Boundary fill using Eight Connected
1. Boundary Fill Method

boundary-fill4(x, y, f-color, b-color)


{
if(getpixel (x,y) ! = b-color&&gepixel (x, y) ! = f-color)
{
putpixel (x, y, f-color)
boundary-fill4(x + 1, y, f-color, b-color);
boundary-fill4(x, y + 1, f-color, b-color);
boundary-fill4(x - 1, y, f-color, b-color);
boundary-fill4(x, y - l, f-color, b-color);
}
}
2. Boundary Eight Connected

boundary-fill8(x, y, f-color, b-color)


{
if(getpixel (x,y) ! = b-color&&gepixel (x, y) ! = f-color)
{
putpixel (x, y, f-color)
boundary-fill4(x + 1, y, f-color, b-color);
boundary-fill4(x+1, y + 1, f-color, b-color);
boundary-fill4(x , y+1, f-color, b-color);
boundary-fill4(x-1, y+1, f-color, b-color);
boundary-fill4(x - 1, y, f-color, b-color);
boundary-fill4(x-1, y - 1, f-color, b-color);
boundary-fill4(x + 1, y-1, f-color, b-color);
boundary-fill4(x, y - l, f-color, b-color);
}
}

You might also like