![](http://images-20200215.ebookreading.net/23/1/1/9781482247336/9781482247336__a-computational-introduction__9781482247336__bgff.png)
Image Segmentation 237
(a) Cutting up the image (b) Thresholding each part separately
FIGURE 9.13: Adaptive thresholding
What this command means is that we apply our function
thresh to each distinct 648 ×162
block of our image.
9.6 Edge Detection
Edges contain some of the most useful information in an image. We may use edges to
measure the size of objects in an image; to isolate particular objects from their background;
to recognize or classify objects. There are a large number of edge-finding algorithms in
existence, and we shall look at some of the more straightforward of them. The general
command in MATLAB or Octave for finding edges is
edge(image,’method’,parameters. . . )
where the parameters available depend on the method used. In Python, there are many
edge detection methods in the
filter module of skimage. In this chapter, we shall show
how to create edge images using basic filtering methods, and discuss the uses of those edge
functions.
An edge may be loosely defined as a local discontinuity in the pixel values which exceeds
a given threshold. More informally, an edge is an observable difference in pixel values. For
example, consider the two 4 × 4 blocks of pixels shown in Figure 9.14.
51 52 53 59
54 52 53 62
50 52 53 68
55 52 53 55
50 53 155 160
51 53 160 170
52 53 167 190
51 53 162 155
FIGURE 9.14: Blocks of pixels
In the right-hand block, there is a clear difference between the gray values in the second
and third columns, and for these values the differences exceed 100. This would be easily
discernible in an image—the human eye can pick out gray differences of this magnitude
with relative ease. Our aim is to develop methods that will enable us to pick out the edges
of an image.