comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: finding the center of gravity of an irregularly shaped roi within a 2d array
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: finding the center of gravity of an irregularly shaped roi within a 2d array [message #81257 is a reply to message #81256] Mon, 03 September 2012 09:24 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
ian.j.ashpole@googlemail.com writes:

> If i can ask, as i am unable to find this in the code as a relative novice, how does your program actually calculate the centroid coordinates?

Each pixel in the ROI is assigned a "weight" of 1, then
a simple center-of-mass calculation is done:

totalMass = Total(array)
xcm = Total( Total(array, 2) * Indgen(arrayXSize) * scale[0] ) $
/ totalMass
ycm = Total( Total(array, 1) * Indgen(arrayYSize) * scale[1] ) $
/ totalMass
center = [xcm, ycm]

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: IDL hangs on futex_wait_private
Next Topic: Re: Dash Docset for IDL 8.1

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 01:19:25 PDT 2025

Total time taken to generate the page: 0.79618 seconds