Blurring images
We can blur images with a Gaussian filter (for more information on Gaussian filter visit http://en.wikipedia.org/wiki/Gaussian_filter). This filter is based on the normal distribution. A corresponding SciPy function requires the standard deviation as a parameter.
In this recipe, we will also plot a polar rose and a spiral (for more information on Polar coordinate system visit http://en.wikipedia.org/wiki/Polar_coordinate_system). These figures are not directly related, but it seemed more fun to combine them here.
How to do it...
We will start by initializing the polar plots, after which we will blur the Lena image and plot in the polar coordinates.
Initialization.
Initialize the polar plots as follows:
NFIGURES = int(sys.argv[1]) k = numpy.random.random_integers(1, 5, NFIGURES) a = numpy.random.random_integers(1, 5, NFIGURES) colors = ['b', 'g', 'r', 'c', 'm', 'y', 'k']
Blur Lena.
In order to blur Lena, we will apply the Gaussian filter with standard deviation of four:
matplotlib...