![]() |
[求助]关于flood_fill算法的疑问
我下了一个flood_fill(种子染色算法)做填充。可是区域大点matlab就跳出来了。好像是堆栈溢出了。咋办呢?
function flood_fill(xc,yc,x,y,new,old,width,height) % flood fills area of matrix % (xc,yc) = start point of flood fill % (x,y) = current test location % new = new value to be filled % old = old value to replace global fill; global call; call = call + 1; if (x<2 || x>=width) x = xc; end if (y<2 || y>=height) y = yc; end if (fill(y,x) == old) fill(y,x) = new; flood_fill(xc,yc,x+1,y,new,old,width,height); flood_fill(xc,yc,x,y+1,new,old,width,height); flood_fill(xc,yc,x-1,y,new,old,width,height); flood_fill(xc,yc,x,y-1,new,old,width,height); end :ft: |
所有时间均为北京时间。现在的时间是 14:02。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.