%matplotlib inline
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
For the purpose of illustration we use a cartoon image, i.e. an image that does not have any texture.
image = io.imread("../images/mickey-mouse-image.jpg")
grayscale = rgb2gray(image)
fig, ax = plt.subplots(figsize=(8, 8))
plt.imshow(grayscale, cmap=plt.cm.gray)
Check the documentation and vary the parameters to see how the result changes.
canny_edges = feature.canny(grayscale, sigma=1.5,
low_threshold=None,
high_threshold=None,
mask=None,
use_quantiles=False)
fig, ax = plt.subplots(figsize=(8, 8))
plt.imshow(canny_edges, cmap=plt.cm.gray)