Edge operatorsΒΆ

Edge operators are used in image processing within edge detection algorithms. They are discrete differentiation operators, computing an approximation of the gradient of the image intensity function.

../_images/plot_edge_filter_1.png

import matplotlib.pyplot as plt

from skimage.data import camera
from skimage.filter import roberts, sobel


image = camera()
edge_roberts = roberts(image)
edge_sobel = sobel(image)

fig, (ax0, ax1) = plt.subplots(ncols=2)

ax0.imshow(edge_roberts, cmap=plt.cm.gray)
ax0.set_title('Roberts Edge Detection')
ax0.axis('off')

ax1.imshow(edge_sobel, cmap=plt.cm.gray)
ax1.set_title('Sobel Edge Detection')
ax1.axis('off')

plt.show()

STDOUT


        

STDERR


        

Python source code: download (generated using skimage 0.11dev)

IPython Notebook: download (generated using skimage 0.11dev)

aW1wb3J0IG1hdHBsb3RsaWIucHlwbG90IGFzIHBsdAoKZnJvbSBza2ltYWdlLmRhdGEgaW1wb3J0IGNhbWVyYQpmcm9tIHNraW1hZ2UuZmlsdGVyIGltcG9ydCByb2JlcnRzLCBzb2JlbAoKCmltYWdlID0gY2FtZXJhKCkKZWRnZV9yb2JlcnRzID0gcm9iZXJ0cyhpbWFnZSkKZWRnZV9zb2JlbCA9IHNvYmVsKGltYWdlKQoKZmlnLCAoYXgwLCBheDEpID0gcGx0LnN1YnBsb3RzKG5jb2xzPTIpCgpheDAuaW1zaG93KGVkZ2Vfcm9iZXJ0cywgY21hcD1wbHQuY20uZ3JheSkKYXgwLnNldF90aXRsZSgnUm9iZXJ0cyBFZGdlIERldGVjdGlvbicpCmF4MC5heGlzKCdvZmYnKQoKYXgxLmltc2hvdyhlZGdlX3NvYmVsLCBjbWFwPXBsdC5jbS5ncmF5KQpheDEuc2V0X3RpdGxlKCdTb2JlbCBFZGdlIERldGVjdGlvbicpCmF4MS5heGlzKCdvZmYnKQoKcGx0LnNob3coKQ==