Image Blob Detection Using Recursive Flood Fill
Mostra commenti meno recenti
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
Risposte (1)
Image Analyst
il 9 Dic 2018
0 voti
See my magic wand demo, which tries to copy the Photoshop magic wand tool.
Categorie
Scopri di più su Image Processing and Computer Vision in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!