  In this paper, an image denoising algorithm is proposed for salt and pepper
noise. First, a generative model is built on a patch as a basic unit and then
the algorithm locates the image noise within that patch in order to better
describe the patch and obtain better subsequent clustering. Second, the
algorithm classifies patches using a generative clustering method, thus
providing additional similarity information for noise repair and suppressing
the interference of noise, abandoning those categories that consist of a
smaller number of patches. Finally, the algorithm builds a non-local switching
filter to remove the salt and pepper noise. Simulation results show that the
proposed algorithm effectively denoises salt and pepper noise of various
densities. It obtains a better visual quality and higher peak signal-to-noise
ratio score than several state-of-the-art algorithms. In short, our algorithm
uses a noisy patch as the basic unit, a patch clustering method to optimize the
repair data set as well as obtain a better denoising effect, and provides a
guideline for future denoising and repair methods.
