Center of Contour

Center of Contour

Post by Spee » Fri, 21 Jul 2006 22:49:45


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,

Center of Contour

Post by roberso » Sat, 22 Jul 2006 00:35:51

In article < XXXX@XXXXX.COM >,

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.

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".
All is vanity. -- Ecclesiastes