Allow me to show you a snip from Szeliski's Computer Vision book on bilateral filter. I don't know how to interpret these kernel definitions:

enter image description here

In the actual summation what values do the $k$ and $l$ take? E.g For a kernel of size 5x5 does $k$ take values between negative and positive inf? or between 1 to 5 (e.g. in matlab programming)? Or does it take values from -2 to 2?

Also what do those double bars mean in the definition of range kernel?

  • $\begingroup$ using bilateral filter implimentaion, the iteration results showing better results comparing with other methods, but i dint understand how to chnage the parameters in general equation. $\endgroup$
    – user18487
    Commented Nov 27, 2015 at 0:30

2 Answers 2


A small discussion of the details you've asked for:

  1. The bilateral filter is controlled by two parameters: $\sigma$d and $\sigma$r.

• As the range parameter $\sigma$r increases, the bilateral filter becomes closer to Gaussian blur because the range Gaussian is flatter i.e., almost a constant over the intensity interval covered by the image.

• Increasing the spatial parameter $\sigma$d smooths larger features.

An important characteristic of bilateral filtering is that the weights are multiplied, which implies that as soon as one of the weight is close to 0, no smoothing occurs. As an example, a large spatial Gaussian coupled with narrow range Gaussian achieves a limited smoothing although the filter has large spatial extent. The range weight enforces a strict preservation of the contours.

"The Norm or the double bars indicate the gaussian distance in the equation.This distance is defined by Gσ(||p − q||), where σ is a parameter defining the extension of the neighborhood."

Since (i,j) and (k,l) are simply spatial points on an image, they will vary from the start of the image to the end of the image. Typically this would be dependent on your indexing measure, for example in a matrix, you've have to range from 0 to 5 for a 5x5 image. The actual values of k,l matter little. Its the relative value which matters far more.


Typically in image processing, a filter kernel is centered upon the destination pixel, so in your example, $k$ and $l$ would take on the values $-2, 1, 0, 1, 2$.

The double-vertical-bar symbol is typically used to denote some kind of norm. In your case, since (I'm assuming) $f(i,j)$ and $f(k,l)$ are scalar values, I'm assuming $\lVert f(i,j) - f(k,l) \rVert^2$ refers to the squared magnitude of the difference between the two pixel values.

  • $\begingroup$ thanks. these are color images. so f(i,j)-f(k,l) is a vector. $\endgroup$ Commented Dec 17, 2012 at 16:44
  • $\begingroup$ I have been reading about bilateral filters and have been confused about the implementation. I asked a question here dsp.stackexchange.com/questions/61988/… . It will be very helpful if you could share your understanding of the bilateral filter. $\endgroup$ Commented Nov 17, 2019 at 11:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.