We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4cf5f37 commit 129ecd4Copy full SHA for 129ecd4
examples/unsharp.py
@@ -0,0 +1,33 @@
1
+from PIL import Image
2
+from pylab import *
3
+from scipy.ndimage import filters
4
+
5
6
+"""
7
+This is an example of unsharp masking using Gaussian blur.
8
9
10
+# load sample eye image from http://en.wikipedia.org/wiki/Unsharp_masking
11
+im = array(Image.open("unsharpen.jpg").convert("L"), "f")
12
13
+# create blurred version of the image
14
+sigma = 3
15
+blurred = filters.gaussian_filter(im,sigma)
16
17
+# create unsharp version (no thresholding)
18
+weight = 0.25
19
+unsharp = im - 0.25*blurred
20
21
22
+# plot the original and the unsharpened image
23
+figure()
24
+imshow(im)
25
+gray()
26
+title("original image")
27
28
29
+imshow(unsharp)
30
31
+title("unsharp mask with weight {}".format(weight))
32
33
+show()
examples/unsharpen.jpg
16 KB
0 commit comments