@@ -276,14 +276,15 @@ sigma = 3.0
276276
277277# apply Gaussian blur, creating a new image
278278blurred = skimage.filters.gaussian(
279- image, sigma=(sigma, sigma), truncate=3.5, channel_axis=2 )
279+ image, sigma=(sigma, sigma), truncate=3.5, channel_axis=-1 )
280280~~~
281281{: .language-python}
282282
283- The first two parameters to `skimage.filters.gaussian()` are the image to blur,
283+ The first two arguments to `skimage.filters.gaussian()` are the image to blur,
284284`image`, and a tuple defining the sigma to use in ry- and cx-direction,
285285`(sigma, sigma)`.
286- The third parameter `truncate` gives the radius of the kernel in terms of sigmas.
286+ The third parameter `truncate` is meant to pass the radius of the kernel in
287+ number of sigmas.
287288A Gaussian function is defined from -infinity to +infinity, but our kernel
288289(which must have a finite, smaller size) can only approximate the real function.
289290Therefore, we must choose a certain distance from the centre of the function
@@ -294,8 +295,21 @@ For example, for a `sigma` of 1.0 the resulting kernel size would be 7,
294295while for a `sigma` of 2.0 the kernel size would be 14.
295296The default value for `truncate` in scikit-image is 4.0.
296297
297- The last parameter to `skimage.filters.gaussian()` tells skimage
298- to interpret our image, that has three dimensions, as a multichannel colour image.
298+ The last argument we passed to `skimage.filters.gaussian()` is used to
299+ specify the dimension which contains the (colour) channels.
300+ Here, it is the last dimension;
301+ recall that, in Python, the `-1` index refers to the last position.
302+ In this case, the last dimension is the third dimension (index `2`), since our
303+ image has three dimensions:
304+
305+ ~~~
306+ print(image.ndim)
307+ ~~~
308+ {: .language-python}
309+ ~~~
310+ 3
311+ ~~~
312+ {: .output }
299313
300314Finally, we display the blurred image:
301315
0 commit comments