There are two methods I know of to get subpixel accuracy that are used by Vision. The first is averaging, and the second is interpolation.
For the centroid, the standard sum Ax/sum A formula is used, where A is the intensity of each pixel. The result is the x coordinate of the centroid (balance point). This is essentially using the average value of a large number of pixels to give you subpixel accuracy. One warning about the centroid function is that it must be a white object on a black background to get useful results. The background is included in the calculation, so if your background is not black it will shift the centroid value.
Interpolation is mostly used when finding an edge. Based on the high and low grayscale values, the intermediate grayscale value at the edge is used to determine the edge location to subpixel accuracy.
Bruce
Bruce Ammons
Ammons Engineering