d – Diameter of each pixel neighborhood that is used during filtering. If it is non-positive, it is computed from sigmaSpace .

sigmaColor – Filter sigma in the color space. A
larger value of the parameter means that farther colors within the pixel
neighborhood (see sigmaSpace ) will be mixed together, resulting in larger areas of semi-equal color.

sigmaSpace – Filter sigma in the coordinate space. A
larger value of the parameter means that farther pixels will influence
each other as long as their colors are close enough (see sigmaColor ). When d>0 , it specifies the neighborhood size regardless of sigmaSpace . Otherwise, d is proportional to sigmaSpace .

A bilateral filter is non-linear, edge-preserving and noise-reducing smoothing
filter. The intensity value at each pixel in an image is replaced by a
weighted average of intensity values from nearby pixels. This weight can
be based on a Gaussian distribution. Crucially, the weights depend not
only on Euclidean distance of pixels, but also on the radiometric
differences. For example, the range difference such as color intensity,
depth distance, etc. This preserves sharp edges by systematically
looping through each pixel and adjusting weights to the adjacent pixels
accordingly.