<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/162907</link>
    <title>MATLAB Central Newsreader - How does bwlabel work?</title>
    <description>Feed for thread: How does bwlabel work?</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2008 by The MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>The MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Thu, 31 Jan 2008 19:23:14 -0500</pubDate>
      <title>Re: How does bwlabel work?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/162907#412295</link>
      <author>roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)</author>
      <description>In article &amp;lt;fnt68l$tv$1@fred.mathworks.com&amp;gt;,&lt;br&gt;
Ross  &amp;lt;ross.nospam.kozz@yahoo.com&amp;gt; wrote:&lt;br&gt;
&amp;gt;Basically, I'm &lt;br&gt;
&amp;gt;trying to assign "identities" to each blob. So if a blob &lt;br&gt;
&amp;gt;starts labelled as 2, even if it moves to a different &lt;br&gt;
&amp;gt;location, I'd like it to remain as 2, and not change to a &lt;br&gt;
&amp;gt;different label. &lt;br&gt;
&lt;br&gt;
&amp;gt;That will give me the ability to track these blobs rather &lt;br&gt;
&amp;gt;than just know where the blobs are. &lt;br&gt;
&lt;br&gt;
That is not possible in general, unless additional motion information&lt;br&gt;
can be provided.&lt;br&gt;
&lt;br&gt;
Consider image1 with two non-intersecting circles, C1, C2, near the&lt;br&gt;
bottom of the image, and then consider image2 with two non-intersecting&lt;br&gt;
circles near the top of the image. So C1 moved upwards and C2 moved&lt;br&gt;
upwards? Not necessarily: C1 and C2 might have moved in diagonally&lt;br&gt;
opposite directions and changed places, so in image2 the identities&lt;br&gt;
might be in the order C2 then C1.&lt;br&gt;
&lt;br&gt;
The tracking problem is significantly worse if the blobs can shrink&lt;br&gt;
or grow or divide (one blob split, or two overlapping blobs seperate).&lt;br&gt;
Recorded color changes with shadows and lighting angle, so the&lt;br&gt;
boundaries of a moving blob might not be the same in two images,&lt;br&gt;
even beyond "staircase" effects of image quantization into&lt;br&gt;
discrete pixels.&lt;br&gt;
&lt;br&gt;
bwlabel thus cannot really be expected to track blob identities.&lt;br&gt;
You need to do some kind of post processing to find some kind of&lt;br&gt;
"signature" for each blob to determine which is which, and that&lt;br&gt;
signature is likely to need to incorporate domain-specific knowledge.&lt;br&gt;
-- &lt;br&gt;
&amp;nbsp;&amp;nbsp;"All is vanity."                                   -- Ecclesiastes&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Thu, 31 Jan 2008 19:07:01 -0500</pubDate>
      <title>Re: How does bwlabel work?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/162907#412292</link>
      <author>Ross </author>
      <description>Wolfgang, thanks for this link -&lt;br&gt;
&lt;br&gt;
&lt;a href="http://blogs.mathworks.com/steve/category/connected-"&gt;http://blogs.mathworks.com/steve/category/connected-&lt;/a&gt;&lt;br&gt;
components/&lt;br&gt;
&lt;br&gt;
That's an excellent resource. &lt;br&gt;
&lt;br&gt;
Steve, I look forward to your blog update. Basically, I'm &lt;br&gt;
trying to assign "identities" to each blob. So if a blob &lt;br&gt;
starts labelled as 2, even if it moves to a different &lt;br&gt;
location, I'd like it to remain as 2, and not change to a &lt;br&gt;
different label. &lt;br&gt;
&lt;br&gt;
That will give me the ability to track these blobs rather &lt;br&gt;
than just know where the blobs are. &lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Thu, 31 Jan 2008 15:57:13 -0500</pubDate>
      <title>Re: How does bwlabel work?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/162907#412242</link>
      <author>Steve Eddins</author>
      <description>Walter Roberson wrote:&lt;br&gt;
&amp;gt; In article &amp;lt;fnsk56$1oh$1@fred.mathworks.com&amp;gt;,&lt;br&gt;
&amp;gt; Steve Eddins  &amp;lt;Steve.Eddins@mathworks.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;&amp;gt; There's no way to tell bwlabel to search in a different order.  If it &lt;br&gt;
&amp;gt;&amp;gt; did search in a different order, it would run significantly slower &lt;br&gt;
&amp;gt;&amp;gt; because of memory cache effects.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; You (the programmer desiring the "different order") could transpose&lt;br&gt;
&amp;gt; or fliplr or flipud the matrix first ;-)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I have never tried bwlabel(), so I do not have any feel for its&lt;br&gt;
&amp;gt; performance on different image sizes, and I have not looked at&lt;br&gt;
&amp;gt; the algorithm used. But as a user, I would think that if I have&lt;br&gt;
&amp;gt; good reasons to want a different search order, that I would accept&lt;br&gt;
&amp;gt; the performance implications that went along with chosing that&lt;br&gt;
&amp;gt; option. I would suggest, then, that you consider allowing an&lt;br&gt;
&amp;gt; optional parameter which is a permutation vector of the&lt;br&gt;
&amp;gt; (1-D) pixel indices, with the pixels to be visited in the order&lt;br&gt;
&amp;gt; of that vector.&lt;br&gt;
&lt;br&gt;
It's a good suggestion, but I would not be inclined to make that change &lt;br&gt;
for these reasons:&lt;br&gt;
&lt;br&gt;
a. User can preprocess image, as you suggested&lt;br&gt;
b. User can postprocess output labels, as I will probably demonstrate &lt;br&gt;
soon on my blog&lt;br&gt;
c. Lack of well-defined sorting order for two-dimensional space&lt;br&gt;
d. Substantial increase in complexity of code and testing, with a &lt;br&gt;
corresponding increase in the likelihood of programming errors&lt;br&gt;
e. "Opportunity cost" - implementing this change means we would not have &lt;br&gt;
time for implementing other requested features, including other &lt;br&gt;
user-suggested changes to bwlabel that would have broader benefit&lt;br&gt;
&lt;br&gt;
In my opinion, user post-processing, assisted by the output of &lt;br&gt;
regionprops, is probably the best way to go because of reason c.  Even &lt;br&gt;
if we permute the search order, the output labels may still not be &lt;br&gt;
ordered exactly the way the user desired, whatever that might be.&lt;br&gt;
&lt;br&gt;
Thanks,&lt;br&gt;
&lt;br&gt;
Steve&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Thu, 31 Jan 2008 14:58:20 -0500</pubDate>
      <title>Re: How does bwlabel work?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/162907#412224</link>
      <author>roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)</author>
      <description>In article &amp;lt;fnsk56$1oh$1@fred.mathworks.com&amp;gt;,&lt;br&gt;
Steve Eddins  &amp;lt;Steve.Eddins@mathworks.com&amp;gt; wrote:&lt;br&gt;
&lt;br&gt;
&amp;gt;There's no way to tell bwlabel to search in a different order.  If it &lt;br&gt;
&amp;gt;did search in a different order, it would run significantly slower &lt;br&gt;
&amp;gt;because of memory cache effects.&lt;br&gt;
&lt;br&gt;
You (the programmer desiring the "different order") could transpose&lt;br&gt;
or fliplr or flipud the matrix first ;-)&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
I have never tried bwlabel(), so I do not have any feel for its&lt;br&gt;
performance on different image sizes, and I have not looked at&lt;br&gt;
the algorithm used. But as a user, I would think that if I have&lt;br&gt;
good reasons to want a different search order, that I would accept&lt;br&gt;
the performance implications that went along with chosing that&lt;br&gt;
option. I would suggest, then, that you consider allowing an&lt;br&gt;
optional parameter which is a permutation vector of the&lt;br&gt;
(1-D) pixel indices, with the pixels to be visited in the order&lt;br&gt;
of that vector.&lt;br&gt;
-- &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;"I was very young in those days, but I was also rather dim."&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;-- Christopher Priest&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Thu, 31 Jan 2008 13:58:00 -0500</pubDate>
      <title>Re: How does bwlabel work?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/162907#412206</link>
      <author>Steve Eddins</author>
      <description>Ross asked about the order in which bwlabel searches for connected &lt;br&gt;
components, and whether it's possible to change that order.&lt;br&gt;
&lt;br&gt;
Yumnam wrote:&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;gt; BWlabel basically finds the connected components of a&lt;br&gt;
&amp;nbsp;&amp;gt; binary image. All the pixels in a connected components are&lt;br&gt;
&amp;nbsp;&amp;gt; given a level. The searching of the connected components is&lt;br&gt;
&amp;nbsp;&amp;gt; done in the coulmn-wise fashion, in other words, in&lt;br&gt;
&amp;nbsp;&amp;gt; top-to-bottom scan order. All pixels in the first conected&lt;br&gt;
&amp;nbsp;&amp;gt; component is labeled 1 and those in the second as 2 and so on.&lt;br&gt;
&lt;br&gt;
Right.  Some ordering changes can happen when two or more sets of pixels &lt;br&gt;
are initially assigned different labels, but later the algorithm &lt;br&gt;
discovers they actually belong to the same object.&lt;br&gt;
&lt;br&gt;
There's no way to tell bwlabel to search in a different order.  If it &lt;br&gt;
did search in a different order, it would run significantly slower &lt;br&gt;
because of memory cache effects.&lt;br&gt;
&lt;br&gt;
Wolfgang Schwanghart wrote:&lt;br&gt;
&amp;gt; See:&lt;br&gt;
&amp;gt; &lt;a href="http://blogs.mathworks.com/steve/category/connected-components/"&gt;http://blogs.mathworks.com/steve/category/connected-components/&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
Thanks for the plug, Wolfgang.&lt;br&gt;
&lt;br&gt;
Since this question has come up multiple times, I've added "show how to &lt;br&gt;
post-process output of bwlabel to sort object labels as desired" to my &lt;br&gt;
list of potential blog topics.  Watch for it, maybe soon.&lt;br&gt;
&lt;br&gt;
---&lt;br&gt;
Steve Eddins&lt;br&gt;
&lt;a href="http://blogs.mathworks.com/steve/"&gt;http://blogs.mathworks.com/steve/&lt;/a&gt;&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Thu, 31 Jan 2008 12:04:02 -0500</pubDate>
      <title>Re: How does bwlabel work?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/162907#412184</link>
      <author>Wolfgang Schwanghart</author>
      <description>See:&lt;br&gt;
&lt;a href="http://blogs.mathworks.com/steve/category/connected-components/"&gt;http://blogs.mathworks.com/steve/category/connected-components/&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Yumnam Kirani Singh &amp;lt;kirani.singh@gmail.com&amp;gt; wrote in&lt;br&gt;
message&lt;br&gt;
&amp;lt;14977013.1201760451936.JavaMail.jakarta@nitrogen.mathforum.org&amp;gt;...&lt;br&gt;
&amp;gt; BWlabel basically finds the connected components of a&lt;br&gt;
binary image. All the pixels in a connected components are&lt;br&gt;
given a level. The searching of the connected components is&lt;br&gt;
done in the coulmn-wise fashion, in other words, in&lt;br&gt;
top-to-bottom scan order. All pixels in the first conected&lt;br&gt;
component is labeled -1 and those in the second as 2 and so on.&lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Thu, 31 Jan 2008 06:20:21 -0500</pubDate>
      <title>Re: How does bwlabel work?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/162907#412154</link>
      <author>Yumnam Kirani Singh</author>
      <description>BWlabel basically finds the connected components of a binary image. All the pixels in a connected components are given a level. The searching of the connected components is done in the coulmn-wise fashion, in other words, in top-to-bottom scan order. All pixels in the first conected component is labeled -1 and those in the second as 2 and so on.&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Thu, 31 Jan 2008 05:08:01 -0500</pubDate>
      <title>Re: How does bwlabel work?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/162907#412148</link>
      <author>Vihang Patil</author>
      <description>"Ross " &amp;lt;ross.nospam.kozz@yahoo.com&amp;gt; wrote in message &lt;br&gt;
&amp;lt;fnrdc1$es0$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; I'm trying to understand the algorithm of the bwlabel &lt;br&gt;
&amp;gt; command. Basically, I want to know how bwlabel &lt;br&gt;
determines &lt;br&gt;
&amp;gt; the order of labelling (which blob is 1, which blob is 2 &lt;br&gt;
&amp;gt; etc.) and if there's a way to change that ordering.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I checked the Matlab help and it refers to certain pages &lt;br&gt;
&amp;gt; from a book which I don't have access to. &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Can anyone explain how bwlabel works. &lt;br&gt;
&amp;gt;  &lt;br&gt;
&amp;gt; Thanks.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
edit bwlabel&lt;br&gt;
You can see the code.&lt;br&gt;
Vihang&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Thu, 31 Jan 2008 02:56:01 -0500</pubDate>
      <title>How does bwlabel work?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/162907#412132</link>
      <author>Ross </author>
      <description>I'm trying to understand the algorithm of the bwlabel &lt;br&gt;
command. Basically, I want to know how bwlabel determines &lt;br&gt;
the order of labelling (which blob is 1, which blob is 2 &lt;br&gt;
etc.) and if there's a way to change that ordering.&lt;br&gt;
&lt;br&gt;
I checked the Matlab help and it refers to certain pages &lt;br&gt;
from a book which I don't have access to. &lt;br&gt;
&lt;br&gt;
Can anyone explain how bwlabel works. &lt;br&gt;
&amp;nbsp;&lt;br&gt;
Thanks.&lt;br&gt;
</description>
    </item>
  </channel>
</rss>
