 Then, assuming the range and spatial kernels to be Gaussian kernels, the weight assigned for pixel formula_16 to denoise the pixel formula_15 is given by

where σd and σr are smoothing parameters, and "I"("i", "j") and "I"("k", "l") are the intensity of pixels formula_15 and formula_21 respectively.After calculating the weights, normalize them