This paper proposes a very effective salt and pepper noise detecting algorithm,two poles threshold detecting method,according to the feature of salt and pepper noise pixels in digital images,and validates this algorithm's validity by experiment.Based on the two poles threshold detecting method,this paper proposes an improved median filtering algorithm farther.The improved algorithm can filter highly density salt and pepper noises in digital images effectively,and preserve image details by the greatest extent.