Re: Center of mess [message #35980] |
Tue, 05 August 2003 06:45  |
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.
|
|
|