| Author |
Message |
Speed *nix forums beginner
Joined: 16 Feb 2006
Posts: 4
|
Posted: Thu Jul 20, 2006 1:49 pm Post subject:
Center of Contour
|
|
|
Hi,
Could you please tell me what is the most efficient way of finding the
center of mass of the area enclosed by a closed contour.
I have a considerable circular region with streaks coming out of it in
either direction. Basically i want to find the center of the circular
region but it is getting offset due to the presence of connected
outlier segments.
I am working with binary images only.
Thanks a ton,
Soumyadip. |
|
| Back to top |
|
 |
Walter Roberson *nix forums Guru
Joined: 19 Feb 2005
Posts: 1300
|
Posted: Thu Jul 20, 2006 3:35 pm Post subject:
Re: Center of Contour
|
|
|
In article <1153403385.696050.78980@i42g2000cwa.googlegroups.com>,
Speed <lostandhappy@gmail.com> wrote:
| Quote: | Could you please tell me what is the most efficient way of finding the
center of mass of the area enclosed by a closed contour.
|
That's an algorithm, which could be implemented in most any language.
It is not a C specific question, so you should ask in an
algorithms newsgroup, or possibly a graphics newsgroup.
| Quote: | I have a considerable circular region with streaks coming out of it in
either direction. Basically i want to find the center of the circular
region but it is getting offset due to the presence of connected
outlier segments.
I am working with binary images only.
|
<OT>
The "most efficient way" is going to depend upon the size of the images,
upon whether you assume constant density, and upon the complexity
of the outlier segments (e.g., simplier if you know they are
strictly convext); also upon how you determine whether a segment
is connected or not (if it only touches on a single diagnonal, is
it connected?)
The "most efficient way" may also depend upon architecture details
of the computer system being used to solve the problem. For example,
if the entire image easily fits within primary cache, then the efficient
algorithms available are going to differ from situations in which the
images are large and all of the data for one row (or column) is
consequative in memory, and are going to differ again from situations
in which the images are large but are stored as "tiles" in memory.
Thus the "most efficient way" is going to depend greatly on the details
of the assumptions you can make about your images and their internal
representation and about the characteristics of your computer system.
Finding "the most efficient way" could potentially be a matter of weeks
or months of research.
You'd probably have more success if instead you asked about
"reasonably efficient ways" instead of "the most efficient way".
</OT>
--
All is vanity. -- Ecclesiastes |
|
| Back to top |
|
 |
Morris Dovey *nix forums addict
Joined: 22 Jun 2005
Posts: 90
|
Posted: Thu Jul 20, 2006 4:58 pm Post subject:
Re: Center of Contour [OT]
|
|
|
Speed (in 1153403385.696050.78980@i42g2000cwa.googlegroups.com) said:
| Could you please tell me what is the most efficient way of finding
| the center of mass of the area enclosed by a closed contour.
|
| I have a considerable circular region with streaks coming out of it
| in either direction. Basically i want to find the center of the
| circular region but it is getting offset due to the presence of
| connected outlier segments.
|
| I am working with binary images only.
Soumyadip...
It's not really a difficult problem; but the answer would depend on
what you mean by "efficiency". Are you looking for the smallest code
footprint - or are you looking for fastest execution time?
--
Morris Dovey
DeSoto Solar
DeSoto, Iowa USA
http://www.iedu.com/DeSoto |
|
| Back to top |
|
 |
Morris Dovey *nix forums addict
Joined: 22 Jun 2005
Posts: 90
|
Posted: Fri Jul 21, 2006 5:05 am Post subject:
Re: Center of Contour [VOT]
|
|
|
Morris Dovey (in FFOvg.3$HO.119@news.uswest.net) said:
| It's not really a difficult problem; but the answer would depend on
| what you mean by "efficiency". Are you looking for the smallest code
| footprint - or are you looking for fastest execution time?
I thought it might be an interesting exercise. Including some #defines
to parameterize the problem, the solution took fewer than 2 dozen
statements. It was compact _and_ fast.
Pleased with myself, I leaned back and thought about possible/probable
uses for the code...
....and then deleted the files.
Sometimes life just sucks.
--
Morris Dovey
DeSoto Solar
DeSoto, Iowa USA
http://www.iedu.com/DeSoto |
|
| Back to top |
|
 |
Soumyadip Rakshit *nix forums beginner
Joined: 21 Jan 2006
Posts: 9
|
Posted: Fri Jul 21, 2006 11:06 am Post subject:
Re: Center of Contour [OT]
|
|
|
I am working with a 120x160 binary edge image and by efficient I mean -
mostlly speed of execution.
"Morris Dovey" <mrdovey@iedu.com> wrote in message
news:FFOvg.3$HO.119@news.uswest.net...
| Quote: | Speed (in 1153403385.696050.78980@i42g2000cwa.googlegroups.com) said:
| Could you please tell me what is the most efficient way of finding
| the center of mass of the area enclosed by a closed contour.
|
| I have a considerable circular region with streaks coming out of it
| in either direction. Basically i want to find the center of the
| circular region but it is getting offset due to the presence of
| connected outlier segments.
|
| I am working with binary images only.
Soumyadip...
It's not really a difficult problem; but the answer would depend on
what you mean by "efficiency". Are you looking for the smallest code
footprint - or are you looking for fastest execution time?
--
Morris Dovey
DeSoto Solar
DeSoto, Iowa USA
http://www.iedu.com/DeSoto
|
|
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|