Patent ID: 8274597

Claim:
A computer-implemented method for measuring a border of an image of an object, the method comprising: (a) setting measurement parameters of the object, the measurement parameters comprising a length of a measurement line and a sampling interval of the object to determine accurate border points of the object; (b) selecting a start point, an end point, and an image capture direction of the object to capture an image of a border of the object, assigning a variable “isS” with a value of “true” if an image of the object is the first captured image, and setting the start point as a current point of the object; (c) moving a charge coupled device (CCD) lens of an image measuring machine to the current point; (d) capturing an image of the object, performing binary image processing on the border of the captured image to obtain a binary image, and obtaining sequential border points in the binary image; (e) performing an automatic focus function on the border of the object if the sequential border points in the binary image are fuzzy, and repeating the step (d), or going directly to the step (f) if the sequential border points are clear, wherein the sequential border points in the binary image are determined to be fuzzy by: sampling a preset quantity of border points from the sequential border points; calculating an average value of grads of the sampled border points; and determining the sequential border points are fuzzy if the average value of grads is less than a preset value; (f) determining if the border of the object has been completely captured according to the sequential border points in the binary image, and displaying success information if the border of the object has been completely captured, or executing step (g) if the border of the object has not been completely captured; and (g) calculating accurate border points according to the length of the measurement line and the sampling interval, selecting a last point from the accurate border points as a new start point to capture a next image of the object, determining a position of the CCD lens according to the new start point to capture the next image of the object, marking isS=false if an image of the object is not the first captured image, and setting the new start point as the current point, then returning to the step (c).