ER-75, WFCam Guider Centroid Algorithm
Bruce E. Truax
189 Olson Drive
Southington , CT
06489
860.276.0450
fax 860.620.9026
brucet@pcnet.com
Introduction
The guide camera of the EOST Wide Field Camera (WFCam) will require a
centroiding algorithm capable of sensing the location of the guide star to an
accuracy of better than 0.05 arc seconds rms. While this may sound like quite
a difficult task, it should be possible with the proper image magnification,
adequate guide star brightness and a robust centroiding algorithm. ER-60
discusses these issues in detail. The centroid finding model in ER-60 assumes
a priori knowledge of the background noise from the CCD detector. This assumed
noise level is used to threshold the data prior to the application of a first
moment operator which locates the centroid.
The contributors to the background noise level are DC and rms dark current,
amplifier read noise and DC and rms sky brightness. The digitizer setup also
offsets the digitized data by a fixed amount across the entire frame. Dark
current, digitizer offset and amplifier read noise are static parameters
(assuming that the temperature of the CCD is maintained constant) and can be
measured. Sky brightness is dependent primarily on the phase of the moon, the
location of the moon in the sky and the sky glow from nearby population
centers. These contributors vary not only from night to night but can even
vary over the course of a night, perhaps even over the period of a long
exposure. Therefore in order to implement the centroiding algorithm set out in
ER-60 it is necessary to have a dynamic method for determining the threshold
level. This report presents an algorithm for tracking the centroid of a star
incorporating a threshold algorithm which can be used to dynamically set a
threshold value for each acquired image.
Threshold Method
The purpose of the threshold algorithm is to set all data points which contain
only background noise to zero. To do this the threshold level is set to the
mean background noise level plus three times the rms noise variation. If the
threshold value is set to the correct level, a first moment centroid
computation can very accurately locate the position of the star image. The
reason for this can be seen in Figure 1. If a first moment computation is
performed on the entire array of data with an off center star image, the noise
data values will tend to pull the centroid towards the center of the array. By
thresholding the data so that all of the noise is set to zero the centroid
pulling is eliminated.

Star
Image Before and After Thresholding.
Figure
1.
Conceptually it is easy to describe a method for setting the threshold. By
starting at highest point on the image and walking down the "mountain" the
level of the noise is reached when the steep descent stops and levels out.
This point can be found mathematically using a second moment computation. By
starting at the highest point in the image a threshold is set at one A/D level
below the peak and the second moment of the coordinates of all points above
this level is computed. The threshold level is then reduced by one A/D level
and the second moment is recomputed. The result of this computation on the
data in Figure 1 is shown in Figure 2. Notice that as the threshold decreases
from its peak of 200 the second moment stays almost at zero until around 30
where it takes a sharp turn upward. This is the level of the background noise
and the proper level for the threshold setting (the model noise value for this
data is
).

Second Moment vs. Threshold Level
Figure
2.
Sensing the location of the knee of the curve can be done by monitoring when
the slope of the curve crosses a threshold. It is necessary to filter the
second moment data to make it smoother to minimize the noies in the first
derivative. Figure 3 shows a filtered second moment and the first derivative
of the filtered data over a smaller range. Notice that by simply watching for
the first derivative data to cross a preset level (100 was chosen) a value for
the threshold can be found.

Filtered
Second Moment and First Derivative
Figure
3.
Centroid Algorithm
- Point the telescope such that an appropriate guide star is in the field of
view of the guide camera and start tracking. This star should be the brightest
star in the field.
- Set the exposure time for the guide camera. Ideally this exposure time
should create a peak intensity greater than 50% of camera saturation (but never
saturated). This may not always be possible on dim stars and the actual peak
intensity might be much lower.
- Allow the guide camera to integrate and acquire the first guide frame.
- Search the entire guide camera image and find the brightest pixel.
- Set a 15x15 pixel window around the brightest pixel.
- Threshold the data
- Find the values of the lowest and highest data points in the window. Set
these value to Level_Low and Level_High respectively.
- Search the window for the points with the value Level_High.
- Compute the sum of the squares of the distances of these points from the
center of the window put this value in Current_Sum.
- If this is the first point store Current_Sum in
Second_Moment(Level) else store Current_Sum+Second_Moment(Level-1)
in Second_Moment(Level).
- Level = Level - 1.
- Go to 6.2 until Level = Level_Low.
- Filter Second_Moment using a normalized moving 5 point center
weighted filter (weights of 1,2,3,2,1, Normalization factor = 9), put the
result in Filtered_Second_Moment.
- Set Level = 2.
- Compute Filtered_Second_Moment(Level) - Filtered_Second_Moment(Level -
1) beginning at Level_Low until the result is less than 100.
- Set Threshold = Level.
- Set every point in the Window with a value less than or equal to
Threshold to zero, set all other points to Value - Threshold.
- Locate the Centroid
- Compute the intensity weighted first moment for the x direction. This is
done by summing the product of the intensity of a pixel times it's x-distance
from the center of the window and dividing this product by the sum of all of
the intensities in the window. Save this value as x_centroid.
- Compute the intensity weighted first moment for the y direction. This is
done by summing the product of the intensity of a pixel times it's y-distance
from the center of the window and dividing this product by the sum of all of
the intensities in the window. Save this value as y_centroid.
- Scale x_centroid and y_centroid to real units by
dividing by the telescope plate scale factor.
- Store the centroid position, this will be the reference position for the
centroid.
- Set the guide camera controller to acquire the same 15x15 window
identified in step 5.
- Integrate
- Read out the subarray.
- Begin next integration.
- Threshold the data
- Locate the centroid
- Compute the distance and direction from the computed centroid to the
reference centroid.
- Send the offset distance and direction information to the TCC.
- Go to 11.
NOTE: Because the window used to track the centroid is so small, it is not
necessary to flat field the camera. This assumes that the camera response is
relatively uniform across the centroid window which should be a safe
assumption. If camera testing determines that hte camera response varies by
more than 5% across the centriod window, a flat fielding step must be added.
Conclusion
The centroid finding algorithm presented in this report can locate a star
centroid to very high precision. The algorithm automatically identifies the
detector noise level and sets a threshold which removes the effects of
background noise from the centroid computation.
It should be noted that the algorithm in this report was written and presented
in a manner which (I hope) makes it easy to understand. There are numerous
modifications to the sequencing and method of computation which do not change
the result but improve the efficiency of the algorithm significantly. The need
for a more computationally efficient algorithm depends on the speed of the
processor performing the computation. In order to track at the highest
projected tracking rate of 1 frame/second with reasonable latency, this
algorithm should be executed in less than 500 milliseconds.