bwlabeln problem.*
Show older comments
*Hello to everyone on matlab community!
I m trying to use bwlabeln to find the connected pixels tha construct a gaussian spot. So i have my table Z =
0.0000 0.0001 0.0007 0.0035 0.0111 0.0236 0.0337 0.0323
0.0000 0.0003 0.0020 0.0095 0.0301 0.0640 0.0915 0.0877
0.0001 0.0007 0.0046 0.0217 0.0686 0.1459 0.2084 0.1999
0.0001 0.0013 0.0088 0.0414 0.1311 0.2788 0.3982 0.3820
0.0002 0.0020 0.0141 0.0664 0.2101 0.4469 0.6382 0.6121
0.0003 0.0027 0.0189 0.0892 0.2824 0.6005 0.8577 0.8226
0.0003 0.0030 0.0213 0.1005 0.3183 0.6769 0.9666 0.9272
0.0003 0.0029 0.0202 0.0950 0.3009 0.6398 0.9137 0
and i write
the following code but it doesn't return all the connected pixels of my table.
BW=im2bw(Z); [L,NUM] = bwlabeln(BW) for i=1:NUM r=0; c=0; [r,c]=find(L==i) size(r) temp=0; temp(r,c)=Z(r,c) end
i take temp =
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0.4469 0.6382 0.6121
0 0 0 0 0 0.6005 0.8577 0.8226
0 0 0 0 0 0.6769 0.9666 0.9272
0 0 0 0 0 0.6398 0.9137 0
that is'n right!!Because i have and other connectd components to the spot *
Accepted Answer
More Answers (2)
Mary Kodogianni
on 12 Feb 2011
0 votes
Mary Kodogianni
on 12 Feb 2011
0 votes
1 Comment
Walter Roberson
on 12 Feb 2011
You need to initialize
temp = zeros(size(Z));
before doing the copy.
Categories
Find more on Object Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!