This paper presents a two-step restoration algorithm for impulse noise detection and removal. In the detection step, the pixel which is most likely corrupted by noise is detected according to its gray values. In the removal step, the proposed algorithm adaptively alters the filtering window size dep