In: Computer Science
Bilateral filtering is a method to smooth an image while preserving edges. Briefly explain the main idea of bilateral filtering in your own words and how it preserves the edges in an image
Read Szleski’s book
Filtering is the most fundamental operation of image processing.Image filtering is useful for many applications, including sharpening, smoothing and removing noise etc.Bilateral filtering uses nearby image values, it smooths images using a non linear combination of the same and while smoothing the image, edges are also preserved. The method is noniterative, local, and simple. It combines the colors based on how close the pixels are geometrically and their photometric similarity. It prefers near values in terms of both domain and range.The bilateral filter has some qualities that explain its success:
Every pixel is replaced by a weighted average of the neighbour pixels. This is important because it makes it easy to acquire information about its behavior, to adapt it to specific requirements, and implement it.
It depends on two parameters which indicate the size and contrast of the features that are to be preserved.
It can be used in a non-iterative manner. This makes the parameters easy to set since it is not cumulative over multiple iterations.
It can be computed at interactive speed even on large images
How it preserves the edges:
Bilateral filter takes into account the intensity variation to preserve edges. The rationale of bilateral filtering is that two pixels are close to each other not only if they are geometrically close but alos if they are photometrically similar. Here are the steps of the algorithm used for preserving edges:
3 components (RBG) of 2 adjacent pixels are evaluated for absolute difference, then 2 of those absolute differences are divided by 4 and added together, 3rd component is divided by 2 and added to the sum. The goal is to get absolute difference between 2 pixels in 0-255 range.
Sigma Spatial: in the implementation, sigma spatial, one of the 2 blur parameters, has depedency on image width and height.
An important characteristic of bilateral filtering is that the weights are multiplied, which means that as soon as one of the weight is close to 0, no smoothing is done.
Equation of bilateral filtering: BF[I] p = 1 /Wp Gσs (||p − q||) Gσr (Ip − Iq) Iq
Wp = Gσs (||p − q||) Gσr (|Ip − Iq|). and Wp is the noramlization factor
Parameters σs and σr will specify the amount of filtering for the image.
As the range parameter σr increases, the bilateral filter gradually approximates Gaussian convolution more closely.
Increasing the spatial parameter σs smooths larger features.