Image Blob Detection Using Recursive Flood Fill
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am trying to detect blobs in an image using recursive flood fill but it seems I am in an infinite loop but cannot figure out why. My input image is only 20x15 pixels but it has been siiting here for at least 10 minutes trying to finish. It seems as though it is stuck in the flood_fill function but I cant figure out why? Is there something wrong with my test?
blobs = im2bw(imread('Week6Image.jpg'),0.1);
[W, H] = size(blobs);
set(0,'RecursionLimit',100000)
out = region_labeling(blobs,W,H);
function I = region_labeling(I,W,H)
label = 2;
for u = 1 : W
%For loop vertical Axis
for v = 1 : H
if I(u,v) == 1
I = flood_fill(I,u,v,label,W,H);
label = label + 1;
end
end
end
end
function I = flood_fill(I,u,v,label,W,H)
if u >= 1 && u <= W && v >= 1 && v <= H && I(u,v) == 1
I(u,v) = label;
I = flood_fill(I,u+1,v,label,W,H);
I = flood_fill(I,u,v+1,label,W,H);
I = flood_fill(I,u,v-1,label,W,H);
I = flood_fill(I,u-1,v,label,W,H);
end
end
0 Kommentare
Antworten (1)
Image Analyst
am 9 Dez. 2018
See my magic wand demo, which tries to copy the Photoshop magic wand tool.
0 Kommentare
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!