gaussian(image, sigma=1, output=None, mode='nearest', cval=0, multichannel=None, preserve_range=False, truncate=4.0)
This function is a wrapper around scipy.ndi.gaussian_filter
.
Integer arrays are converted to float.
The output
should be floating point data type since gaussian converts to float provided image
. If output
is not provided, another array will be allocated and returned as the result.
The multi-dimensional filter is implemented as a sequence of one-dimensional convolution filters. The intermediate arrays are stored in the same data type as the output. Therefore, for output types with a limited precision, the results may be imprecise because intermediate results may be stored with insufficient precision.
Input image (grayscale or color) to filter.
Standard deviation for Gaussian kernel. The standard deviations of the Gaussian filter are given for each axis as a sequence, or as a single number, in which case it is equal for all axes.
The output
parameter passes an array in which to store the filter output.
The mode
parameter determines how the array borders are handled, where cval
is the value when mode is equal to 'constant'. Default is 'nearest'.
Value to fill past edges of input if mode
is 'constant'. Default is 0.0
Whether the last axis of the image is to be interpreted as multiple channels. If True, each channel is filtered separately (channels are not mixed together). Only 3 channels are supported. If None
, the function will attempt to guess this, and raise a warning if ambiguous, when the array has shape (M, N, 3).
Whether to keep the original range of values. Otherwise, the input image is converted according to the conventions of img_as_float
. Also see https://scikit-image.org/docs/dev/user_guide/data_types.html
Truncate the filter at this many standard deviations.
the filtered array
Multi-dimensional Gaussian filter.
>>> a = np.zeros((3, 3))This example is valid syntax, but we were not able to check execution
... a[1, 1] = 1
... a array([[0., 0., 0.], [0., 1., 0.], [0., 0., 0.]])
>>> gaussian(a, sigma=0.4) # mild smoothing array([[0.00163116, 0.03712502, 0.00163116], [0.03712502, 0.84496158, 0.03712502], [0.00163116, 0.03712502, 0.00163116]])This example is valid syntax, but we were not able to check execution
>>> gaussian(a, sigma=1) # more smoothing array([[0.05855018, 0.09653293, 0.05855018], [0.09653293, 0.15915589, 0.09653293], [0.05855018, 0.09653293, 0.05855018]])This example is valid syntax, but we were not able to check execution
>>> # Several modes are possible for handling boundariesThis example is valid syntax, but we were not able to check execution
... gaussian(a, sigma=1, mode='reflect') array([[0.08767308, 0.12075024, 0.08767308], [0.12075024, 0.16630671, 0.12075024], [0.08767308, 0.12075024, 0.08767308]])
>>> # For RGB images, each is filtered separatelySee :
... from skimage.data import astronaut
... image = astronaut()
... filtered_img = gaussian(image, sigma=1, multichannel=True)
The following pages refer to to this document either explicitly or contain code examples using this.
skimage.segmentation.active_contour_model.active_contour
skimage.filters._gaussian.gaussian
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them