Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: connected components in a grey scale image
Replies: 13   Last Post: May 15, 2008 11:01 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Deo

Posts: 50
Registered: 2/13/08
Re: connected components in a grey scale image
Posted: May 15, 2008 8:35 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"us " <us@neurol.unizh.ch> wrote in message <g0h8ao$879
$1@fred.mathworks.com>...
> "Deo ":
> <SNIP down to different problem...
>

> > 0.009 0.009 0.009
> > ...
> > I like to label the image above like
> > 1 1 1
> > ...

>
> well, this is simply re-indexing a mat with unique
> integers - independent of the values
> now, one of the many solutions
>
> % the data
> m=[
> 0.09 0.09 0.09
> 0.01 8.00 0.07
> 0.01 9.00 0.06
> 9.00 0.01 7.00
> ];
> % the engine
> [mu,mx,mx]=unique(m);
> r=reshape(mx,size(m));
> % the result
> % - note: <mu> contains the unique abs value(s)
> disp([m;nan(1,size(m,2));r]);
> %{
> 0.09 0.09 0.09 % the original mat
> 0.01 8.00 0.07
> 0.01 9.00 0.06
> 9.00 0.01 7.00
> NaN NaN NaN % visual divider
> 4.00 4.00 4.00 % re-indexed mat
> 1.00 6.00 3.00
> 1.00 7.00 2.00
> 7.00 1.00 5.00
> %}
>
> us


This approach would only work in this situation but in a
scenario such as this
0.09 0.09 0.09 0.01
0.01 8.00 0.07 0.01
0.01 9.00 0.06 0.1
0.09 0.01 7.00 0.7

when it is required that the output should look as
CC1 CC1 CC1 CC6
CC2 CC4 CC5 CC6
CC2 CC7 CC8 CC9
CC3 CC2 CC10 CC11
where CC1 - CC11 are the connected components and they can
be any integer. You can see that clusters of same intensity
are labeled differently when they are not connected.
This what I am looking for maybe I did not express myself
correctly in the prevoius thread.



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.