I need to delete an object in a binary image for which I have a list of the boundary

points. There may be other objects in the image. The boundary is 8-way connected.

I think that the following algorithm should work:

if no. of boundary points =< 3 then

delete boundary points

else

// search for a point inside the object which is 4-way connected

for each boundary point (x, y)

if (x+1, y+1) has 4-way connectivity then

perform 4-way connected flood fill with (x+1, y+1) as the

seed

endif

endfor

repeat the above loop with the following offsets until all boundary

points have been deleted

(x-1, y-1), (x+1, y), (x-1, y), (x, y+1), (x, y-1),

(x+1, y-1), (x-1, y+1), (x-1, y+1), (x, y)

if after using all the above offset some of the boundary points haven't

been deleted then delete boundary points

endif

Has anyone any suggestions for improvements, alternative algorithms or source code

(perferrably C)?

Thanks.

Bill.