The application discloses a contour extraction method based on an adaptive
ellipse edge detection and fast
fitting algorithm, obtains an image region where an
ellipse is located, and gives a search center, a search direction, a search frame position and size and a search space, and in the search space, from the search center to the search space boundary, according to the search direction, the whole search path of the search frame in the form of a
ray is determined; all pixel values in the search frame are obtained; the gray values of all pixel points in the search frame are obtained; the obtained pixel values are clustered into two categories by using K-Means clustering; the
ellipse is fitted by using a least square method; the
point set far from the ellipse boundary is removed, and the
point set close to the ellipse boundary, that is, the best inner
point set, is left, so that the least square ellipse fitting is completed; and the last point set fitting result is drawn by using key coefficients of an ellipse equation obtained by the least square
algorithm. The application can accurately find the positions of strong edges and weak edges of the ellipse, can autonomously screen inner points and can accurately fit the ellipse equation.