bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / restoration / _denoise / denoise_bilateral
function
skimage.restoration._denoise:denoise_bilateral
source: /dev/scikit-image/src/skimage/restoration/_denoise.py :95
Signature
def denoise_bilateral ( image , win_size = None , sigma_color = None , sigma_spatial = 1 , bins = 10000 , mode = constant , cval = 0 , * , channel_axis = None ) Summary
Denoise image using bilateral filter.
Parameters
image: ndarray, shape (M, N[, 3])Input image, 2D grayscale or RGB.
win_size: intWindow size for filtering. If win_size is not specified, it is calculated as
max(5, 2 * ceil(3 * sigma_spatial) + 1).sigma_color: floatStandard deviation for grayvalue/color distance (radiometric similarity). A larger value results in averaging of pixels with larger radiometric differences. If
None, the standard deviation ofimagewill be used.sigma_spatial: floatStandard deviation for range distance. A larger value results in averaging of pixels with larger spatial differences.
bins: intNumber of discrete values for Gaussian weights of color filtering. A larger value results in improved accuracy.
mode: {'constant', 'edge', 'symmetric', 'reflect', 'wrap'}How to handle values outside the image borders. See numpy.pad for detail.
cval: int or floatUsed in conjunction with mode 'constant', the value outside the image boundaries.
channel_axis: int or None, optionalIf
None, the image is assumed to be grayscale (single-channel). Otherwise, this parameter indicates which axis of the array corresponds to channels.
Returns
denoised: ndarrayDenoised image.
Notes
This is an edge-preserving, denoising filter. It averages pixels based on their spatial closeness and radiometric similarity [1].
Spatial closeness is measured by the Gaussian function of the Euclidean distance between two pixels and a certain standard deviation (sigma_spatial).
Radiometric similarity is measured by the Gaussian function of the Euclidean distance between two color values and a certain standard deviation (sigma_color).
Note that, if the image is of any int dtype, image will be converted using the img_as_float function and thus the standard deviation (sigma_color) will be in range [0, 1].
For more information on scikit-image's data type conversions and how images are rescaled in these conversions, see: https://scikit-image.org/docs/stable/user_guide/data_types.html.
Examples
from skimage import data, img_as_float astro = img_as_float(data.astronaut()) astro = astro[220:300, 220:320] rng = np.random.default_rng() noisy = astro + 0.6 * astro.std() * rng.random(astro.shape) noisy = np.clip(noisy, 0, 1) denoised = denoise_bilateral(noisy, sigma_color=0.05, sigma_spatial=15, channel_axis=-1)✓
Aliases
-
skimage.restoration.denoise_bilateral