Random-Valued Impulse Noise Detection and Removal in Grayscale and Color Images