LoslegenKostenlos loslegen

Smoothing

Smoothing can improve the signal-to-noise ratio of your image by blurring out small variations in intensity. The Gaussian filter is excellent for this: it is a circular (or spherical) smoothing kernel that weights nearby pixels higher than distant ones.

The width of the distribution is controlled by the sigma argument, with higher values leading to larger smoothing effects.

For this exercise, test the effects of applying Gaussian filters to the foot x-ray before creating a bone mask.

Diese Übung ist Teil des Kurses

Biomedical Image Analysis in Python

Kurs anzeigen

Anleitung zur Übung

  • Convolve im with Gaussian filters of size sigma=1 and sigma=3.
  • Plot the "bone masks" of im, im_s1, and im_s3 (i.e., where intensities are greater than or equal to 145).

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Smooth "im" with Gaussian filters
im_s1 = ndi.gaussian_filter(____, sigma=____)
im_s3 = ____

# Draw bone masks of each image
fig, axes = plt.subplots(1,3)
axes[0].imshow(____ >= 145)
axes[1].imshow(____)
____
format_and_render_plot()
Code bearbeiten und ausführen