@@ -32,8 +32,8 @@ background of the image ends and the object begins.
32
32
33
33
When we blur an image, we make the color transition from one side of an edge in the image to another
34
34
smooth rather than sudden. The effect is to average out rapid changes in pixel intensity. A blur is
35
- a very common operation we need to perform before other tasks such as
36
- [ thresholding] ({{ page.root }}/07-thresholding). There are several different blurring functions
35
+ a very common operation we need to perform before other tasks such as
36
+ [ thresholding] ({{ page.root }}/07-thresholding). There are several different blurring functions
37
37
in the ` skimage.filters ` module, so we will focus on just one here, the * Gaussian blur* .
38
38
39
39
> ## Filters
@@ -224,11 +224,11 @@ The first two parameters to `skimage.filters.gaussian()` are the image to blur,
224
224
`image`, and a tuple defining the sigma to use in y- and x-direction,
225
225
`(sigma, sigma)`. The third parameter `truncate` gives the radius of the kernel
226
226
in terms of sigmas. A Gaussian function is defined from -infinity to +infinity, but
227
- our kernel (which must have a finite, smaller size) can only approximate the real function.
227
+ our kernel (which must have a finite, smaller size) can only approximate the real function.
228
228
Therefore, we must choose a certain distance from the centre of the function where we stop
229
229
this approximation, and set the final size of our kernel. In the above example, we set
230
230
`truncate` to 3.5, which means the kernel size will be 2 * sigma * 3.5. For example,
231
- for a `sigma` of 1.0 the resulting kernel size would be 7, while for a
231
+ for a `sigma` of 1.0 the resulting kernel size would be 7, while for a
232
232
`sigma` of 2.0 the kernel size would be 14. The default value for `truncate` in scikit-image is 4.0.
233
233
234
234
The last parameter to `skimage.filters.gaussian()` tells skimage to interpret our image, that has three
@@ -247,7 +247,14 @@ plt.show()
247
247
248
248
> ## Experimenting with sigma values (10 min)
249
249
>
250
- > Try running the code above with a range of smaller and larger sigma values.
250
+ > The size and shape of the kernel used to blur an image can have a
251
+ > significant effect on the result of the blurring and any downstream analysis
252
+ > carried out on the blurred image.
253
+ > The next two exercises ask you to experiment with the sigma values of the kernel,
254
+ > which is a good way to develop your understanding of how the choice of kernel
255
+ > can influence the result of blurring.
256
+ >
257
+ > First, try running the code above with a range of smaller and larger sigma values.
251
258
> Generally speaking, what effect does the sigma value have on the
252
259
> blurred image?
253
260
>
@@ -264,9 +271,9 @@ plt.show()
264
271
265
272
> ## Experimenting with kernel shape (10 min - optional, not included in timing)
266
273
>
267
- > Now, try running the code above with different sigmas in the y and x direction.
274
+ > Now, what is the effect of applying an asymmetric kernel to blurring an image?
275
+ > Try running the code above with different sigmas in the y and x direction.
268
276
> For example, a sigma of 1.0 in the y direction, and 6.0 in the x direction.
269
- > What is the effect on the blurred image?
270
277
>
271
278
> > ## Solution
272
279
> >
@@ -282,9 +289,18 @@ plt.show()
282
289
> > plt.show()
283
290
> > ~~~
284
291
> > {: .language-python}
292
+ > >
285
293
> > 
286
- > > This produces a kernel that is rectangular instead of square. Notice that the image
287
- > > is much more blurred in the x direction than the y direction.
294
+ > >
295
+ > > These unequal sigma values produce a kernel that is rectangular instead of square.
296
+ > > The result is an image that is much more blurred in the x direction than the
297
+ > > y direction.
298
+ > > For most use cases, a uniform blurring effect is desirable and
299
+ > > this kind of asymmetric blurring should be avoided.
300
+ > > However, it can be helpful in specific circumstances e.g. when noise is present in
301
+ > > your image in a particular pattern or orientation, such as vertical lines.
302
+ > >
303
+ > >
288
304
> {: .solution}
289
305
{: .challenge}
290
306
0 commit comments