Visit the wiki pages to find some additional documentation and instructions on how view an interactive verson of these notebooks using binder.

In [1]:
%matplotlib inline
In [2]:
import math
import numpy as np
import matplotlib.pyplot as plt


from skimage import measure
from skimage.color import rgb2gray
from skimage import io
from skimage import filters
from skimage import feature

Detecting edges in images

For the purpose of illustration we use a cartoon image, i.e. an image that does not have any texture.

In [3]:
image = io.imread("../images/mickey-mouse-image.jpg")
grayscale = rgb2gray(image)
In [4]:
fig, ax = plt.subplots(figsize=(8, 8))
plt.imshow(grayscale, cmap=plt.cm.gray)
Out[4]:
<matplotlib.image.AxesImage at 0x7ff506707610>

Canny edge detector

Check the documentation and vary the parameters to see how the result changes.

In [12]:
canny_edges = feature.canny(grayscale, sigma=1.5, 
                            low_threshold=None, 
                            high_threshold=None, 
                            mask=None, 
                            use_quantiles=False)
In [13]:
fig, ax = plt.subplots(figsize=(8, 8))
plt.imshow(canny_edges, cmap=plt.cm.gray)
Out[13]:
<matplotlib.image.AxesImage at 0x7ff506d93c10>
Explore: Replace the cartoon image with one of the medical images that are provide. Find out how different values of sgima affect the computed edges.
In [ ]: