Abstract:A new algorithm for edge detection is proposed to anti-noisely detect weak edges and broken edges produced in traditional edge detectors. First, edge is extracted and then connected. Edge is the reaction of gray mutation. The gradient of the pixels is composed of weighted pixel number which signifys the amount of pixels adjoin this pixel in the symmetry location. The direction of the pixels with larger gradient is calculated. Edges are extracted based on the continuity of pixels′ direction. To compensate the faults of edge image, we use ant colony algorithm to connect edges. The experimental result shows that the method has strong anti-noise ability, especially for salt and pepper noise, and can effectively detect the edge of gradation change significantly.