We introduce an oracle filter for removing the Gaussian noise with weights depending on a similarity function. The usual Non-Local Means filter is obtained from this oracle filter by substituting the similarity function by an estimator based on similarity patches. When the sizes of the search window are chosen appropriately, it is shown that the oracle filter converges with the optimal rate. The same optimal convergence rate is preserved when the similarity function has suitable errors-in measurements. We also provide a statistical estimator of the similarity which converges at a convenient rate. Based on our convergence theorems, we propose some simple formulas for the choice of the parameters. Simulation results show that our choice of parameters improves the restoration quality of the filter compared with the usual choice of parameters in the original algorithm.

Figure 4.
The restored image (left) and it its square error (right) with different similarity patch sizes $d = 7, 9, 21, 41$ and the same search window size $D = 13.$ The original image Lena was polluted by a Gaussian noise with $\sigma = 20$

Figure 5.
The restored image (left) and it its square error (right) with different similarity patch sizes $d = 7, 9, 21, 41$ and the same search window size $D = 13.$ The original image Boat was polluted by a Gaussian noise with $\sigma = 20$

Figure 6.
The restored image (left) and it its square error (right) with different similarity patch sizes $d = 7, 9, 21, 41$ and the same search window size $D = 13.$ The original image Peppers was polluted by a Gaussian noise with $\sigma = 20$

Figure 8.
The restored image (left) and it its square error (right) with the same similarity patch size $d = 21$ and different search window sizes $D = 9,13, 17, 21$. The original image Boat was polluted by a Gaussian noise with $\sigma = 20$

Figure 9.
The restored image (left) and it its square error (right) with the same similarity patch size $d = 21$ and different search window sizes $D = 9,13, 17, 21$. The original image Peppers was polluted by a Gaussian noise with $\sigma = 20$

Figure 10.
The restored image (left) and it its square error (right) with the same similarity patch size $d = 21$ and different search window sizes $D = 9,13, 17, 21$. The original image Lena was polluted by a Gaussian noise with $\sigma = 20$