The Algorithm of Rosenfeld


The algorithm described here is a simple parallel algorithm due to Rosenfeld.This algorithm works by successively discarding in a parallel fashion subsets of the "boundary" of P.We first define the word of boundary. Let P be, the set of black (one's) pixels. The complement of P is the background (such pixels are white(zero's)). Consider a pixel p1 of P. Label the 8 neighbors of p1 as shown below :

Now we are ready to describe the algorithm which can be viewed in two different modes depending on the type of connectivity used.These algorithms are in part sequential and in part parallel.

ALGORITHM 4-CONNECTED

begin
repeat until no pixels are changed from black to white:

step 1 :(in parallel)Change all black pixels to white if they are north borther points that are 4-simple but neither 4-isolated nor 4-endpiont.
step 2 :(in parallel)Change all black pixels to white if they are south borther points that are 4-simple but neither 4-isolated nor 4-endpiont.
step 3 :(in parallel)Change all black pixels to white if they are east borther points that are 4-simple but neither 4-isolated nor 4-endpiont.
step 4 :(in parallel)Change all black pixels to white if they are west borther points that are 4-simple but neither 4-isolated nor 4-endpiont.
end repeat
end

ALGORITHM 8-CONNECTED

begin
repeat until no pixels are changed from black to white:

step 1 :(in parallel)Change all black pixels to white if they are north borther points that are 8-simple but neither 8-isolated nor 8-endpiont.
step 2 :(in parallel)Change all black pixels to white if they are south borther points that are 8-simple but neither 8-isolated nor 8-endpiont.
step 3 :(in parallel)Change all black pixels to white if they are east borther points that are 8-simple but neither 8-isolated nor 8-endpiont.
step 4 :(in parallel)Change all black pixels to white if they are west borther points that are 8-simple but neither 8-isolated nor 8-endpiont.
end repeat
end

The order of the sequential part of algorithm,i.e.,the north, south, east, west sequence for examining border points is arbitrary but should be consistent.It also helps to alternate in this way in order to obtain skeletons that are centered in the original pattern.

An important property of this algorithm is that it preserves the connectivity of the input pattern.

Home