Abstract: A digital filtering algorithm preprocesses couplet defects prior to their being operated on by a main filtering algorithm that focuses on singlet defects. The preprocessing involves the replacement of one of the defective pixel values in the couplet with a pixel value that is known to be non-defective. In preferred embodiments, the selection of the pixel value in the couplet to be replaced is customized depending on the direction of scanning of the pixel array, and can take into account edge effects of border pixels.