  Shack-Hartmann wavefront sensing relies on accurate spot centre measurement.
Several algorithms were developed with this aim, mostly focused on precision,
i.e. minimizing random errors. In the solar and extended scene community, the
importance of the accuracy (bias error due to peak-locking, quantisation or
sampling) of the centroid determination was identified and solutions proposed.
But these solutions only allow partial bias corrections. To date, no systematic
study of the bias error was conducted. This article bridges the gap by
quantifying the bias error for different correlation peak-finding algorithms
and types of sub-aperture images and by proposing a practical solution to
minimize its effects. Four classes of sub-aperture images (point source,
elongated laser guide star, crowded field and solar extended scene) together
with five types of peak-finding algorithms (1D parabola, the centre of gravity,
Gaussian, 2D quadratic polynomial and pyramid) are considered, in a variety of
signal-to-noise conditions. The best performing peak-finding algorithm depends
on the sub-aperture image type, but none is satisfactory to both bias and
random errors. A practical solution is proposed that relies on the
anti-symmetric response of the bias to the sub-pixel position of the true
centre. The solution decreases the bias by a factor of ~7 to values of < 0.02
pix. The computational cost is typically twice of current cross-correlation
algorithms.
