Finding edges in an image
Finding edges in images is a good way of reducing a complex image that contains a lot of noise and distractions to a very simple image containing the most prominent outlines. This can be useful as our first step of the analysis process, such as in image classification, or as the process of importing line outlines into computer graphics software packages.
In this recipe, we will learn how to use the scikit-image
package and the Canny algorithm to find the edges in a complex image.
Getting ready
For this recipe, we will need to import the Matplotlib pyplot
module as plt
, the imread
routine from the skimage.io
module, and the canny
routine from the skimage.feature
module:
import matplotlib.pyplot as plt from skimage.io import imread from skimage.feature import canny
The canny
routine implements the edge detection algorithm. Let’s see how to use it.
How to do it…
Follow these steps to learn how to use the scikit-image
package...