Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function [ img ] = region_growing( img, seed )
- [x, y] = size(img);
- s1 = seed(1);
- s2 = seed(2);
- img(s1, s2) = 0;
- if ((s1 ~= 1) && img(s1 - 1, s2) == 255)
- img = region_growing(img, [s1 - 1, s2]);
- end
- if ((s1 ~= (x - 1)) && img(s1 + 1, s2) == 255)
- img = region_growing(img, [s1 + 1, s2]);
- end
- if ((s2 ~= 1) && img(s1, s2-1) == 255)
- img = region_growing(img, [s1, s2-1]);
- end
- if ((s2 ~= (y - 1)) && img(s1, s2 + 1) == 255)
- img = region_growing(img, [s1, s2 + 1]);
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement