The document describes an image filtering technique that uses all neighboring directional weighted pixels in a 5x5 window to detect and filter random valued impulse noise. It uses particle swarm optimization to optimize the parameters for the detection and filtering operators. The technique detects noisy pixels using differences between pixel values aligned in four directions in the window. Filtering replaces the pixel with the value that minimizes the variance calculated from pixels in the direction with lowest variance. PSO searches a three-dimensional space of iteration number, threshold, and threshold decrease rate parameters to optimize performance for images with different noise levels. Results show it performs better than other techniques at preserving details while removing noise from highly corrupted images.