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

Home » Public Forums » archive » Re: Center of mess
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: Center of mess [message #35980] Tue, 05 August 2003 06:45 Go to previous message
James Kuyper is currently offline  James Kuyper
Messages: 425
Registered: March 2000
Senior Member
Thomas Launey wrote:
>
> In article <onwudshe4a.fsf@cow.physics.wisc.edu>,
> craigmnet@cow.physics.wisc.edu says...
>
>>
>> Hmm, the problem is that you are assigning pixel values with DINDGEN,
>> which by default will assign 0.0 to pixel 0, 1.0 to pixel 1, and so
>> on. You should add 0.5 to your pixel values, if you intend that the
>> left edge of the pixel is 0.0, the right edge is 1.0, and the center
>> is 0.5, etc.
>>
>> Y=Total(total(array,1,/double)*(dindgen(sizarr[1]) + 0.5))/totalarr
>>
>> and so on.
>>
>> Good luck,
>>
>> Craig
>>
> Actually, my solution was to add 0.5D to the returned X and Y. Still, I
> am concerned that this procedure (without the "+0.5") seems to be quite
> widespread in the IDL community to find centroid. Am I misunderstanding
> the meaning of the returned values ...

Yes. Craig explained the correct interpretation of the returned values.
It is, in a certain sense, the natural interpretation, because it's the
one that is produced by one of the simplest version of the algorithm.
One alternative that would appeal to someone from a Fortran background
would be to assign 1.0 to the center of the first row/column, rather
than 0.0.
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: IDL 6 is available on RSI ftp site
Next Topic: Problems with MPEG

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

Current Time: Wed Oct 08 15:23:03 PDT 2025

Total time taken to generate the page: 0.00371 seconds