E1C07 09/14/2010
14:43:52 Page 300
various levels of gray shading. The grayscale images in Figures 7.30 and 7.31 are 8-bit digital images;
each pixel is assigned a number between 0 and 256, with zero corresponding to pure black.
The device that enables digital imaging is termed a charge-coupled device (CCD).
2 A CCD
image sensor is essentially an array of capacitors that gain charge when exposed to light. Each
capacitor represents one pixel in the resulting digital image. A digital camera may have a physical or
an electronic shutter, but in either case the CCD array is active for an exposure time exactly as film
cameras function. Once the exposure is over, the CCD accumulated charge is converted to a digital
representation of the image. The resolution of the image is determined by the number of pixels.
Common cameras may have resolutions that range from 0.3 million pixels (MP) to 21 MP, but higher
resolutions are available.
In many applications for digital imaging, the images are transferred directly from the camera to
a computer, with image acquisition rates as fast as 200,000 frames per second. The term
framegrabber is used to describe the computer hardware that acquires the images from a CCD
camera. Most framegrabber hardware is in the form of a plug-in board or an external module for a
PC. As with any photography, very short exposure times require high-intensity lighting.
Image Processing
A basic treatment of the fundamentals and applications of digital image processing would easily
require an entire book. So our purpose here is to describe one basic issue as illustrative of the impact
of digital image processing. Let’s consider again Figure 7.30, which shows five coins. Two tasks that
might be reasonable to ask an imaging system to accomplish are to locate the coins and determine
their diameter.
Both of these tasks can be accomplished if we can locate the outer edges of the coins. Edge
detection methods are a widely researched and documented area of image processing. In principle,
an edge occurs where the gradient of the pixel intensity is a maximum. So, some numerical scheme
for finding the gradient is required. In a two-dimensional image, the gradient has both magnitude
and direction. For the two-dimensional array that comprises a grayscale image, two gradients are
calculated, one in the x-direction and one in the y-direction (horizontal and vertical in the image).
Using these two numerical estimates of the gradient, a magnitude and direction can be determined.
We will explore two gradient-based methods, Sobel and Canny as they are implemented in Matlab.
The basic differences in these two methods are the degree of smoothing and the criteria for defining
an edge. The Canny method smoothes the image to suppress noise and uses two threshold values in
determining the location of an edge. Gradient values that are below the low threshold result in a pixel
being assigned as a non-edge. Pixels where gradient values are above the high threshold are set as
edges pixels. Gradient values between the two thresholds are examined to see if adjacent pixels are
an edge, and if there is a direct path to an edge pixel that pixel is included as an edge.
The implementation of edge detection in Matlab is a very straightforward process for grayscale
images. The function imread creates the m  n matrix of grayscale values. The function edge
identifies the edges with the method selected. The function imshow views the image.
Figure 7.32 shows the results of the two edge detection methods for our image of coins. Clearly
the grayscale image contains information that causes the edge detection methods to find many edges
that have nothing to do with our coins. One method to improve the chances of finding the edges of
2 The CCD was invented in 1969 at AT&T Bell Labs by Willard Boyle and George Smith (Bell Sys Tech J. 49(4), 1970). In
2009 they shared the Nobel Prize in physics for their invention of the CCD.
300 Chapter 7 Sampling, Digital Devices, and Data Acquisition
14:43:52 Page 300
various levels of gray shading. The grayscale images in Figures 7.30 and 7.31 are 8-bit digital images;
each pixel is assigned a number between 0 and 256, with zero corresponding to pure black.
The device that enables digital imaging is termed a charge-coupled device (CCD).
2 A CCD
image sensor is essentially an array of capacitors that gain charge when exposed to light. Each
capacitor represents one pixel in the resulting digital image. A digital camera may have a physical or
an electronic shutter, but in either case the CCD array is active for an exposure time exactly as film
cameras function. Once the exposure is over, the CCD accumulated charge is converted to a digital
representation of the image. The resolution of the image is determined by the number of pixels.
Common cameras may have resolutions that range from 0.3 million pixels (MP) to 21 MP, but higher
resolutions are available.
In many applications for digital imaging, the images are transferred directly from the camera to
a computer, with image acquisition rates as fast as 200,000 frames per second. The term
framegrabber is used to describe the computer hardware that acquires the images from a CCD
camera. Most framegrabber hardware is in the form of a plug-in board or an external module for a
PC. As with any photography, very short exposure times require high-intensity lighting.
Image Processing
A basic treatment of the fundamentals and applications of digital image processing would easily
require an entire book. So our purpose here is to describe one basic issue as illustrative of the impact
of digital image processing. Let’s consider again Figure 7.30, which shows five coins. Two tasks that
might be reasonable to ask an imaging system to accomplish are to locate the coins and determine
their diameter.
Both of these tasks can be accomplished if we can locate the outer edges of the coins. Edge
detection methods are a widely researched and documented area of image processing. In principle,
an edge occurs where the gradient of the pixel intensity is a maximum. So, some numerical scheme
for finding the gradient is required. In a two-dimensional image, the gradient has both magnitude
and direction. For the two-dimensional array that comprises a grayscale image, two gradients are
calculated, one in the x-direction and one in the y-direction (horizontal and vertical in the image).
Using these two numerical estimates of the gradient, a magnitude and direction can be determined.
We will explore two gradient-based methods, Sobel and Canny as they are implemented in Matlab.
The basic differences in these two methods are the degree of smoothing and the criteria for defining
an edge. The Canny method smoothes the image to suppress noise and uses two threshold values in
determining the location of an edge. Gradient values that are below the low threshold result in a pixel
being assigned as a non-edge. Pixels where gradient values are above the high threshold are set as
edges pixels. Gradient values between the two thresholds are examined to see if adjacent pixels are
an edge, and if there is a direct path to an edge pixel that pixel is included as an edge.
The implementation of edge detection in Matlab is a very straightforward process for grayscale
images. The function imread creates the m  n matrix of grayscale values. The function edge
identifies the edges with the method selected. The function imshow views the image.
Figure 7.32 shows the results of the two edge detection methods for our image of coins. Clearly
the grayscale image contains information that causes the edge detection methods to find many edges
that have nothing to do with our coins. One method to improve the chances of finding the edges of
2 The CCD was invented in 1969 at AT&T Bell Labs by Willard Boyle and George Smith (Bell Sys Tech J. 49(4), 1970). In
2009 they shared the Nobel Prize in physics for their invention of the CCD.
300 Chapter 7 Sampling, Digital Devices, and Data Acquisition
