Image denoising is an important issue in the field of image processing. This paper defines the three-dimensional axis distance on the basis of three-dimensional histogram, analyzes the distribution features of images three-dimensional axis distance under the influence of non-noise and salt-pepper noise situation, thus the denoising algorithm upon the three-dimensional axis distance is proposed. The proposed algorithm extends image edge at first and then detects noise by employing the three-dimensional axis distance. Finally, the noise is eliminated by excluding noise pixels median filter. The?results of comparisons among the proposed algorithm, median filter, adaptive switching median filter, efficient average filter, modified directional-weighted-median filter, and noise adaptive fuzzy switching median filter verify the effectiveness of the proposed algorithm.