This paper proposes an improved method of edge detection based on the mean shift algorithm. A pixel of an image calculated by the mean shift algorithm eventually converges to a peak point of probability density of the image. The pixel which is farther from the peak point has a greater mean shift vector and higher probability to be an edge pixel. The gradient of the mean shift vector of an edge pixel is a local maximum. During the mean shift iterations, the mean shift vector decreases by steps. Therefore, the vector of the first step is representative, while it is unnecessary to calculate each pixel to its convergence. This reduces the amount of computation and promotes the efficiency of the algorithm in a large extent. First, the image is smoothed by the mean shift filter, and the gradient of the mean shift vector is computed. Then, the local maximum is found by using non-maxima suppression on the gradient, which thins the edges detected. Finally, dual-threshold is used to detect and link edges. The edges detected have more accuracy and continuity. Experimental results show that the proposed method outperforms the conventional methods while suppressing noise and preserving edges.