BilateralFilter
✖
BilateralFilter
applies a bilateral filter of spatial spread σ and pixel value spread μ to data.
Details and Options

- BilateralFilter is a nonlinear local filter used for edge-preserving smoothing. The amount of smoothing is dependent on the values of σ and μ.
- BilateralFilter replaces each pixel by a weighted average of its neighbors, using normalized Gaussian matrices as weights.
- The data can be any of the following:
-
list arbitrary-rank numerical array tseries temporal data such as TimeSeries, TemporalData, … image arbitrary Image or Image3D object audio an Audio object - When applied to multichannel audio signals and images, the Euclidean distance between channel vectors is computed.
- At the data boundaries, BilateralFilter uses smaller neighborhoods.
- The following options can be given:
-
MaxIterations 1 maximum number of iterations WorkingPrecision MachinePrecision the precision to use - BilateralFilter uses a Gaussian matrix of spatial radius 5/2 σ.
- BilateralFilter always returns an image of a real type.
- For large values of μ, bilateral filtering yields results similar to Gaussian filtering.

Background & Context
- BilateralFilter is a filter for smoothing images to remove local variations typically caused by noise, rough textures, etc. BilateralFilter is often used as a preprocessing step before doing other image analysis operations, such as segmentation. Bilateral filtering can also be used to perform unsharp masking by subtracting the filtered image from the original and then adding the original back in.
- BilateralFilter performs a nonlinear edge-preserving smoothing. The smoothing is done by replacing each pixel with a weighted average of its neighbors, where weights are taken from a normalized Gaussian distribution based on color value similarity. Here, the standard deviation σ and mean μ of the Gaussian distribution are specified as arguments.
- BilateralFilter works with arbitrary grayscale and color images, as well as with 3D and 2D images. When applied to multichannel images, BilateralFilter does not operate channel-by-channel but rather uses the Euclidean distance between channel vectors.
- Other edge-preserving filters include MeanShiftFilter and PeronaMalikFilter. Similar filters that are not edge preserving include MeanFilter and GaussianFilter. For large values of the Gaussian distribution mean, bilateral filtering yields results similar to Gaussian filtering.
Examples
open allclose allBasic Examples (3)Summary of the most common use cases
Bilateral filtering of a vector:

https://wolfram.com/xid/0rkspu6rwxu4h0a-s47pnq

Filter a TimeSeries:

https://wolfram.com/xid/0rkspu6rwxu4h0a-wxgjw

https://wolfram.com/xid/0rkspu6rwxu4h0a-g9fo2


https://wolfram.com/xid/0rkspu6rwxu4h0a-dulvtd

Smooth details in a color image:

https://wolfram.com/xid/0rkspu6rwxu4h0a-w48w8

Scope (7)Survey of the scope of standard use cases
Data (7)
Bilateral filtering of a list:

https://wolfram.com/xid/0rkspu6rwxu4h0a-txn89d

Bilateral filtering of a 2D array:

https://wolfram.com/xid/0rkspu6rwxu4h0a-cxywqj

Filter a TimeSeries:

https://wolfram.com/xid/0rkspu6rwxu4h0a-62t833

https://wolfram.com/xid/0rkspu6rwxu4h0a-77v7p5


https://wolfram.com/xid/0rkspu6rwxu4h0a-18tdm0

Filter an Audio signal:

https://wolfram.com/xid/0rkspu6rwxu4h0a-p90slf

https://wolfram.com/xid/0rkspu6rwxu4h0a-o6g2aw


https://wolfram.com/xid/0rkspu6rwxu4h0a-j5yrn4

Bilateral filtering smooths an image while preserving edges:

https://wolfram.com/xid/0rkspu6rwxu4h0a-c8ikmi


https://wolfram.com/xid/0rkspu6rwxu4h0a-6llc2h

Symbolic computation of a bilateral filter:

https://wolfram.com/xid/0rkspu6rwxu4h0a-lhzs1x

Options (6)Common values & functionality for each option
MaxIterations (2)
By default, one iteration of bilateral filtering is performed:

https://wolfram.com/xid/0rkspu6rwxu4h0a-h209k4


https://wolfram.com/xid/0rkspu6rwxu4h0a-0tw4f9

Repeatedly filter a TimeSeries:

https://wolfram.com/xid/0rkspu6rwxu4h0a-ovnshr

https://wolfram.com/xid/0rkspu6rwxu4h0a-cg8j2w


https://wolfram.com/xid/0rkspu6rwxu4h0a-m0dp7

WorkingPrecision (4)
By default, MachinePrecision is used with integer arrays:

https://wolfram.com/xid/0rkspu6rwxu4h0a-cdrg18

Perform exact computation instead:

https://wolfram.com/xid/0rkspu6rwxu4h0a-jt3a9c

By default, the precision of the input is used for real arrays:

https://wolfram.com/xid/0rkspu6rwxu4h0a-2q79si


https://wolfram.com/xid/0rkspu6rwxu4h0a-7f69wx

With symbolic arrays, exact computation is used:

https://wolfram.com/xid/0rkspu6rwxu4h0a-djfeg5

WorkingPrecision is ignored when filtering images:

https://wolfram.com/xid/0rkspu6rwxu4h0a-pc6p9y

An image of a real type is always returned:

https://wolfram.com/xid/0rkspu6rwxu4h0a-o6dztt

Applications (5)Sample problems that can be solved with this function

https://wolfram.com/xid/0rkspu6rwxu4h0a-db1px6

Create a posterization effect by performing multiple iterations:

https://wolfram.com/xid/0rkspu6rwxu4h0a-bsda0u

Bilateral filtering with a large color spread value, used for background removal:

https://wolfram.com/xid/0rkspu6rwxu4h0a-o73w7s

Bilateral filtering as a preprocessing step for image segmentation:

https://wolfram.com/xid/0rkspu6rwxu4h0a-qvmskg

Unsharp masking using bilateral filtering:

https://wolfram.com/xid/0rkspu6rwxu4h0a-jekwvj

Properties & Relations (2)Properties of the function, and connections to other functions
Bilateral filtering performs noise reduction while preserving edges:

https://wolfram.com/xid/0rkspu6rwxu4h0a-s15v2m

MeanFilter also reduces noise, but does not preserve edges:

https://wolfram.com/xid/0rkspu6rwxu4h0a-1qbjvp

For large values of the Gaussian distribution mean, bilateral filtering yields results similar to Gaussian filtering:

https://wolfram.com/xid/0rkspu6rwxu4h0a-vy4lw

Wolfram Research (2010), BilateralFilter, Wolfram Language function, https://reference.wolfram.com/language/ref/BilateralFilter.html (updated 2016).
Text
Wolfram Research (2010), BilateralFilter, Wolfram Language function, https://reference.wolfram.com/language/ref/BilateralFilter.html (updated 2016).
Wolfram Research (2010), BilateralFilter, Wolfram Language function, https://reference.wolfram.com/language/ref/BilateralFilter.html (updated 2016).
CMS
Wolfram Language. 2010. "BilateralFilter." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2016. https://reference.wolfram.com/language/ref/BilateralFilter.html.
Wolfram Language. 2010. "BilateralFilter." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2016. https://reference.wolfram.com/language/ref/BilateralFilter.html.
APA
Wolfram Language. (2010). BilateralFilter. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/BilateralFilter.html
Wolfram Language. (2010). BilateralFilter. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/BilateralFilter.html
BibTeX
@misc{reference.wolfram_2025_bilateralfilter, author="Wolfram Research", title="{BilateralFilter}", year="2016", howpublished="\url{https://reference.wolfram.com/language/ref/BilateralFilter.html}", note=[Accessed: 25-March-2025
]}
BibLaTeX
@online{reference.wolfram_2025_bilateralfilter, organization={Wolfram Research}, title={BilateralFilter}, year={2016}, url={https://reference.wolfram.com/language/ref/BilateralFilter.html}, note=[Accessed: 25-March-2025
]}