Path: news.mathworks.com!not-for-mail
From: Steve Eddins <Steve.Eddins@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How does bwlabel work?
Date: Thu, 31 Jan 2008 08:58:00 -0500
Organization: The MathWorks, Inc.
Lines: 33
Message-ID: <fnsk56$1oh$1@fred.mathworks.com>
References: <fnrl3h$i3i$1@fred.mathworks.com> <14977013.1201760451936.JavaMail.jakarta@nitrogen.mathforum.org> <fnsdfi$it7$1@fred.mathworks.com>
NNTP-Posting-Host: eddinss-lt.dhcp.mathworks.com
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: fred.mathworks.com 1201787878 1809 172.31.57.98 (31 Jan 2008 13:57:58 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 31 Jan 2008 13:57:58 +0000 (UTC)
User-Agent: Thunderbird 2.0.0.9 (Windows/20071031)
In-Reply-To: <fnsdfi$it7$1@fred.mathworks.com>
Xref: news.mathworks.com comp.soft-sys.matlab:448539


Ross asked about the order in which bwlabel searches for connected 
components, and whether it's possible to change that order.

Yumnam wrote:

 > 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.

Right.  Some ordering changes can happen when two or more sets of pixels 
are initially assigned different labels, but later the algorithm 
discovers they actually belong to the same object.

There's no way to tell bwlabel to search in a different order.  If it 
did search in a different order, it would run significantly slower 
because of memory cache effects.

Wolfgang Schwanghart wrote:
> See:
> http://blogs.mathworks.com/steve/category/connected-components/

Thanks for the plug, Wolfgang.

Since this question has come up multiple times, I've added "show how to 
post-process output of bwlabel to sort object labels as desired" to my 
list of potential blog topics.  Watch for it, maybe soon.

---
Steve Eddins
http://blogs.mathworks.com/steve/