November 2018
Intermediate to advanced
492 pages
12h 19m
English
PIL's ImageFilter module's filter function can also be used to find and enhance edges in an image. The following code block shows an example with the UMBC library image as input:
from PIL.ImageFilter import (FIND_EDGES, EDGE_ENHANCE, EDGE_ENHANCE_MORE)im = Image.open('../images/umbc_lib.jpg')pylab.figure(figsize=(18,25))pylab.subplot(2,2,1)plot_image(im, 'original (UMBC library)')i = 2for f in (FIND_EDGES, EDGE_ENHANCE, EDGE_ENHANCE_MORE): pylab.subplot(2,2,i) im1 = im.filter(f) plot_image(im1, str(f)) i += 1pylab.show()
The following screenshot shows the output of the preceding code with different edge finding/enhancing filters:
Read now
Unlock full access