| percol - test if binary image is percolated |
p = percol(img [,direction]) |
| img |
| an image in which 0 is considered background, while positive values are considered object (also called site). |
| direction |
| 1 if percolation is to be tested horizontally; 0 if it is to be tested vertically |
| p |
| 1 if image is percolated; 0 otherwise. |
| Function percol tests if an image is 4-connected from side to side. This is useful for analysing images comming from site percolation simulations. The percol routine has the advantage to be implemented in the C language. |
p=0.02; a = 1*(rand(10,10) <= p) while (~percol(a)) // test the image if one side connects to the other p = p+0.02; a = 1*(rand(10,10) <= p); end // now, surely, the image is connected side-to-side (i.e., it has percolated) xbasc(); imshow(1-a,2); // 1 is displayed as black |
| Ricardo Fabbri <rfabbri@if.sc.usp.br> |
| The latest version of the Scilab Image Processing toolbox can be found at |
| http://siptoolbox.sourceforge.net |
| xgetmouse, xclick, locate |