By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,797 Members | 1,794 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,797 IT Pros & Developers. It's quick & easy.

Mathematical Morphology Program in c/c++

P: n/a
I have a binary array representing an edge points image. The useful edge
points are generally 8 connected. There are some noise which are 8
connected in a group smaller than 10. So I want to remove all the
isolated noise group which contains less than 10 edge points from the
array.

Can any one give some code to cope it ?

Thanks

Stonny
Sep 26 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
stonny wrote:
>
.... snip ...
>
Can any one give some code to cope it ?
[1] c:\c\junk>cat junk.c
#include <stdio.h>

int main(void)
{
int c, sum;

c = 1; sum = 0;
while (c < 9) {
sum += c/c++;
putchar(sum + '0'); putchar(' ');
}
puts("Establishing the meaning of c/c++");
return 0;
}

[1] c:\c\junk>cc junk.c
junk.c: In function `main':
junk.c:9: warning: operation on `c' may be undefined

[1] c:\c\junk>.\a
1 2 3 4 5 6 7 8 Establishing the meaning of c/c++

With that out of the way, maybe someone can translate the rest of
your subject line.

--
Some informative links:
<news:news.announce.newusers
<http://www.geocities.com/nnqweb/>
<http://www.catb.org/~esr/faqs/smart-questions.html>
<http://www.caliburn.nl/topposting.html>
<http://www.netmeister.org/news/learn2quote.html>
<http://cfaj.freeshell.org/google/>

Sep 26 '06 #2

P: n/a
In article <J6********@bath.ac.uk>, stonny <ee***@bath.ac.ukwrote:
>I have a binary array representing an edge points image. The useful edge
points are generally 8 connected. There are some noise which are 8
connected in a group smaller than 10. So I want to remove all the
isolated noise group which contains less than 10 edge points from the
array.
>Can any one give some code to cope it ?
It sounds as if you need an algorithm, rather than assistance
with the meaning of the C language. You should contact an
algorithm newsgroup.

[Off topic]

When you repost there, you should probably clarify what it
means for an edge point to be "8 connected".

It also appears to me that your third sentance does not properly
follow from the first and second. Consider a noise group in
which the points are all only 2 connected, but the grouping includes
at least 10 points. According to your third sentance this is not
a candidate for removal, even though not even one member of the
group is 8 connected, because your third sentance talks only
about the size of the group and not about the properties of the group
members (other than that they are connected to each other.)
I would also ask what you would wish to have happen to the points
which are not at least 8 connected and yet are connected through
a chain (possibly an immediate adjacency) to a grouping that has
sufficiently many 8 connected points.

For example, if I take a 3 x 4 sub-array of edge points, fill that
in, and then surround it by a wall 1 deep of edge points, then
the result is a 4 x 5 sub-array in which 3 x 4 = 12 10 are 8
connected, but the outer wall is not 8 connected. What should happen
to that outer wall?

One can likely come up with topologies in which the overall group
is big enough to survive and yet the removal of a single "less useful"
point (one that is not 8 connected itself), by affecting the connection
counts of up to 7 of the 8-connected points, drops the number of 8
connected points in the group to less than the viable population of 10.
This group could have started with 16 8-connected points, along with
a cast of supporting points of less than 8 connectivity each (but which
are important in establishing the 8 connectivty of the important
points), and yet the loss of a single supporting point could result
in your criteria deeming the whole grouping to be noise. Is that really
want you would want to have happen?
--
All is vanity. -- Ecclesiastes
Sep 26 '06 #3

P: n/a

"Walter Roberson" <ro******@ibd.nrc-cnrc.gc.cawrote in message
news:ef**********@canopus.cc.umanitoba.ca...
In article <J6********@bath.ac.uk>, stonny <ee***@bath.ac.ukwrote:
>>I have a binary array representing an edge points image. The useful edge
points are generally 8 connected. There are some noise which are 8
connected in a group smaller than 10. So I want to remove all the
isolated noise group which contains less than 10 edge points from the
array.
>>Can any one give some code to cope it ?

It sounds as if you need an algorithm, rather than assistance
with the meaning of the C language. You should contact an
algorithm newsgroup.

[Off topic]

When you repost there, you should probably clarify what it
means for an edge point to be "8 connected".

It also appears to me that your third sentance does not properly
follow from the first and second. Consider a noise group in
which the points are all only 2 connected, but the grouping includes
at least 10 points. According to your third sentance this is not
a candidate for removal, even though not even one member of the
group is 8 connected, because your third sentance talks only
about the size of the group and not about the properties of the group
members (other than that they are connected to each other.)
I would also ask what you would wish to have happen to the points
which are not at least 8 connected and yet are connected through
a chain (possibly an immediate adjacency) to a grouping that has
sufficiently many 8 connected points.

For example, if I take a 3 x 4 sub-array of edge points, fill that
in, and then surround it by a wall 1 deep of edge points, then
the result is a 4 x 5 sub-array in which 3 x 4 = 12 10 are 8
connected, but the outer wall is not 8 connected. What should happen
to that outer wall?

One can likely come up with topologies in which the overall group
is big enough to survive and yet the removal of a single "less useful"
point (one that is not 8 connected itself), by affecting the connection
counts of up to 7 of the 8-connected points, drops the number of 8
connected points in the group to less than the viable population of 10.
This group could have started with 16 8-connected points, along with
a cast of supporting points of less than 8 connectivity each (but which
are important in establishing the 8 connectivty of the important
points), and yet the loss of a single supporting point could result
in your criteria deeming the whole grouping to be noise. Is that really
want you would want to have happen?
This sounds like something I SHOULD know, but don't. I've heard you make
references to algorithm newsgroups before, but it just so happens I had a
complexity issue queued up tonight before I went on-line. The ng's that
came up on searching didn't seem to have any life in them. Did you have a
particular one in mind? EC
Sep 27 '06 #4

P: n/a
Elijah Cardon wrote:
>
.... snip ...
This sounds like something I SHOULD know, but don't. I've heard
you make references to algorithm newsgroups before, but it just so
happens I had a complexity issue queued up tonight before I went
on-line. The ng's that came up on searching didn't seem to have
any life in them. Did you have a particular one in mind? EC
comp.programming would be suitable. Cross-posted and follow-ups
set. Don't forget to snip material that is not germane to your
reply.

--
Some informative links:
<news:news.announce.newusers
<http://www.geocities.com/nnqweb/>
<http://www.catb.org/~esr/faqs/smart-questions.html>
<http://www.caliburn.nl/topposting.html>
<http://www.netmeister.org/news/learn2quote.html>
<http://cfaj.freeshell.org/google/>
Sep 27 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.