Edge detection is the first step for image segmentation in image processing. So far there are many algorithms for edge detection. In the paper, a novel algorithm about edge detection is based on the median filtering and Sobel operator. It has strong immunity of noise, edges exquisite and better recognition compared to ordinary sobel operator.