Research Article

Research on Subpixel Algorithm of Fixed-Point Tool Path Measurement

Algorithm 1

Subpixel algorithm.
Input: image IF, measure position’s Y coordinate ym
Output: Subpixel point’s value under the global coordinate of the image xn
Transform input image IF into reverse binary image by equation (1)
Use Satoshi Suzuki’s algorithm [25] and Freeman chain code [26] to find the longest Contour in image as Tool Contour
Sort all points in Tool contour, perform binary search for Tool contour to find a row whose y coordinate value is equal to ym, and get two points where the maximum and minimum values of X coordinate are located
Expand the two points to get ROI area according to the rules mentioned in the previous theoretical part
Calculate ROI region second-order difference point set by equations (3)–(5)
According to the different number of points selected, use the five- or six-point fitting method to obtain the fitting curve expression and calculate five constants of quartic curve by equations (12), (13), or (14)
Calculate roots of quartic curve by equations (6)–(10)
Obtain the qualified root by judging the rationality of roots, and take it as the X coordinate of the zero-crossing point in the ROI area
Calculate xn by equation (11)