For Programmers: Free Programming Magazines  


Home > Archive > Matlab > April 2005 > flood fill









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author flood fill
Raivo Alla

2005-04-27, 9:01 pm

I have problem with my flood fill code.
The code will bring me to infinite loop.
Finally it says that the recursion limit is reached.
Pushing up the limit doesnt work.
Whats wrong with my code?

---------------code-------

function [A,i,j]=recur(A,i,j,color);
[M N]=size(A);

if(i<2|i>=M|j<2|j>=N|A(i,j)<100|A(i,j)==50),
return;
else
(A(i,j))>100,
A(i,j)=color;
recur(A,i+1,j,color);
recur(A,i-1,j,color);
recur(A,i,j+1,color);
recur(A,i,j-1,color);
end
-------------end of code----
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com