By using information entropy to estimate the distribution uniformity of the pixels with a same gray level, an accurate salt and pepper noise detection method is presented based on the statistical property of salt and pepper noise. And then, a new modified mean filter is designed, which sets up noise-centre filtering windows, Moreover, the weighted means are calculated by merely using the non-noise points in each filtering window. The presented filter can efficiently preserve the details of images, avoid the affection of noise points on the restore points, and reduce the dimness of the noise points. Experimental results show that this algorithm has the better performance on noise detection, noise filtering, and the protection of detail.