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 #81256 is a reply to message #81253] Mon, 03 September 2012 09:26 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

>
> 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]

Sorry, I meant to include a link to additional information about
center-of-mass calculations:

http://www.idlcoyote.com/tips/centroid.html

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 22:50:14 PDT 2025

Total time taken to generate the page: 1.12152 seconds