Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Digital Signal Processing. The Scientist and Engineers Guide. Steven W. Smith

.pdf
Скачиваний:
166
Добавлен:
02.05.2014
Размер:
7 Мб
Скачать
☆

Chapter 23Image Formation and Display

387

scanning is used by fax machines and airport x-ray baggage scanners. As a variation, the object can be kept stationary while the detector is moved. This is very convenient when the detector is already mounted on a moving object, such as an aircraft taking images of the ground beneath it. The advantage of line scanning is that speed is traded for detector simplicity. For example, a fax machine may take several seconds to scan an entire page of text, but the resulting image contains thousands of rows and columns.

An even more simplified approach is to acquire the image point-by-point. For example, the microwave image of Venus was acquired one pixel at a time. Another example is the scanning probe microscope, capable of imaging individual atoms. A small probe, often consisting of only a single atom at its tip, is brought exceedingly close to the sample being imaged. Quantum mechanical effects can be detected between the probe and the sample, allowing the probe to be stopped an exact distance from the sample's surface. The probe is then moved over the surface of the sample, keeping a constant distance, tracing out the peaks and valleys. In the final image, each pixel's value represents the elevation of the corresponding location on the sample's surface.

Printed images are divided into two categories: grayscale and halftone. Each pixel in a grayscale image is a shade of gray between black and white, such as in a photograph. In comparison, each pixel in a halftone image is formed from many individual dots, with each dot being completely black or completely white. Shades of gray are produced by alternating various numbers of these black and white dots. For example, imagine a laser printer with a resolution of 600 dots-per-inch. To reproduce 256 levels of brightness between black and white, each pixel would correspond to an array of 16 by 16 printable dots. Black pixels are formed by making all of these 256 dots black. Likewise, white pixels are formed making all of these 256 dots white. Midgray has one-half of the dots white and one-half black. Since the individual dots are too small to be seen when viewed at a normal distance, the eye is fooled into thinking a grayscale has been formed.

Halftone images are easier for printers to handle, including photocopy machines. The disadvantage is that the image quality is often worse than grayscale pictures.

Brightness and Contrast Adjustments

An image must have the proper brightness and contrast for easy viewing. Brightness refers to the overall lightness or darkness of the image. Contrast is the difference in brightness between objects or regions. For example, a white rabbit running across a snowy field has poor contrast, while a black dog against the same white background has good contrast. Figure 23-10 shows four possible ways that brightness and contrast can be misadjusted. When the brightness is too high, as in (a), the whitest pixels are saturated, destroying the detail in these areas. The reverse is shown in (b), where the brightness is set too low, saturating the blackest pixels. Figure (c) shows

388

The Scientist and Engineer's Guide to Digital Signal Processing

 

 

 

 

 

 

a. Brightness too high

b. Brightness too low

 

 

 

 

c. Contrast too high

d. Contrast too low

FIGURE 23-10

Brightness and contrast adjustments. Increasing the brightness makes every pixel in the image becomes lighter. In comparison, increasing the contrast makes the light areas become lighter, and the dark areas become darker. These images show the effect of misadjusting the brightness and contrast.

the contrast set to high, resulting in the blacks being too black, and the whites being too white. Lastly, (d) has the contrast set too low; all of the pixels are a mid-shade of gray making the objects fade into each other.

Figures 23-11 and 23-12 illustrate brightness and contrast in more detail. A test image is displayed in Fig. 23-12, using six different brightness and contrast levels. Figure 23-11 shows the construction of the test image, an array of 80×32 pixels, with each pixel having a value between 0 and 255. The backgound of the test image is filled with random noise, uniformly distributed between 0 and 255. The three square boxes have pixel values of 75, 150 and 225, from left-to-right. Each square contains two triangles with pixel values only slightly different from their surroundings. In other

Chapter 23Image Formation and Display

389

FIGURE 23-11

Brightness and contrast test image. This is the structure of the digital image used in Fig. 23-12. The three squares form dark, medium, and bright objects, each containing two low contrast triangles. This figure indicates the digital numbers (DN) of the pixels in each region.

32 pixels

 

random 0 to 255

 

75

150

225

71

146

221

79

154

229

80 pixels

words, there is a dark region in the image with faint detail, this is a medium region in the image with faint detail, and there is a bright region in the image with faint detail.

Figure 23-12 shows how adjustment of the contrast and brightness allows different features in the image to be visualized. In (a), the brightness and contrast are set at the normal level, as indicated by the B and C slide bars at the left side of the image. Now turn your attention to the graph shown with each image, called an output transform, an output look-up table, or a gamma curve. This controls the hardware that displays the image. The value of each pixel in the stored image, a number between 0 and 255, is passed through this look-up table to produces another number between 0 and 255. This new digital number drives the video intensity circuit, with 0 through 255 being transformed into black through white, respectively. That is, the look-up table maps the stored numbers into the displayed brightness.

Figure (a) shows how the image appears when the output transform is set to do nothing, i.e., the digital output is identical to the digital input. Each pixel in the noisy background is a random shade of gray, equally distributed between black and white. The three boxes are displayed as dark, medium and light, clearly distinct from each other. The problem is, the triangles inside each square cannot be easily seen; the contrast is too low for the eye to distinguished these regions from their surroundings.

Figures (b) & (c) shows the effect of changing the brightness. Increasing the brightness shifts the output transform to the left, while decreasing the brightness shifts it to the right. Increasing the brightness makes every pixel in the image appear lighter. Conversely, decreasing the brightness makes every pixel in the image appear darker. These changes can improve the viewability of excessively dark or light areas in the image, but will saturate the image if taken too far. For example, all of the pixels in the far right square in (b) are displayed with full intensity, i.e., 255. The opposite effect is shown in (c), where all of the pixels in the far left square are displayed as blackest black, or digital number 0. Since all the pixels in these regions have the same value, the triangles are completely wiped out. Also notice that none of the triangles in (b) and (c) are easier to see than in (a). Changing the brightness provides little (if any) help in distinguishing low contrast objects from their surroundings.

390

The Scientist and Engineer's Guide to Digital Signal Processing

Figure (d) shows the display optimized to view pixel values around digital number 75. This is done by turning up the contrast, resulting in the output transform increasing in slope. For example, the stored pixel values of 71 and 75 become 100 and 116 in the display, making the contrast a factor of four greater. Pixel values between 46 and 109 are displayed as the blackest black, to the whitest white. The price for this increased contrast is that pixel values 0 to 45 are saturated at black, and pixel values 110 to 255 are saturated at white. As shown in (d), the increased contrast allows the triangles in the left square to be seen, at the cost of saturating the middle and right squares.

Figure (e) shows the effect of increasing the contrast even further, resulting in only 16 of the possible 256 stored levels being displayed as nonsaturated. The brightness has also been decreased so that the 16 usable levels are centered on digital number 150. The details in the center square are now very visible; however, almost everything else in the image is saturated. For example, look at the noise around the border of the image. There are very few pixels with an intermediate gray shade; almost every pixel is either pure black or pure white. This technique of using high contrast to view only a few levels is sometimes called a grayscale stretch.

The contrast adjustment is a way of zooming in on a smaller range of pixel values. The brightness control centers the zoomed section on the pixel values of interest. Most digital imaging systems allow the brightness and contrast to be adjusted in just this manner, and often provide a graphical display of the output transform (as in Fig. 23-12). In comparison, the brightness and contrast controls on television and video monitors are analog circuits, and may operate differently. For example, the contrast control of a monitor may adjust the gain of the analog signal, while the brightness might add or subtract a DC offset. The moral is, don't be surprised if these analog controls don't respond in the way you think they should.

Grayscale Transforms

The last image, Fig. 23-12f, is different from the rest. Rather than having a slope in the curve over one range of input values, it has a slope in the curve over two ranges. This allows the display to simultaneously show the triangles in both the left and the right squares. Of course, this results in saturation of the pixel values that are not near these digital numbers. Notice that the slide bars for contrast and brightness are not shown in (f); this display is beyond what brightness and contrast adjustments can provide.

Taking this approach further results in a powerful technique for improving the appearance of images: the grayscale transform. The idea is to increase the contrast at pixel values of interest, at the expense of the pixel values we don't care about. This is done by defining the relative importance of each of the 0 to 255 possible pixel values. The more important the value, the greater its contrast is made in the displayed image. An example will show a systematic way of implementing this procedure.

a. Normal

B

C

b. Increased brightness

B

C

c. Decreased brightness

B

C

d.Slightly increased contrast at DN 75

B

C

e.Greatly increased contrast at DN 150

B

C

f.Increased contrast at both DN 75 and 225

B

C

 

Chapter 23Image Formation and Display

391

value

250

 

 

 

 

 

 

200

 

 

 

 

 

 

Output

150

 

 

 

 

 

 

100

 

 

 

 

 

 

 

 

 

 

 

 

 

 

50

 

 

 

 

 

 

 

0

 

 

 

 

 

 

 

0

50

100

150

200

250

 

 

 

 

Input value

 

 

 

value

250

 

 

 

 

 

200

 

 

 

 

 

 

 

 

 

 

 

Output

150

 

 

 

 

 

100

 

 

 

 

 

 

50

 

 

 

 

 

 

0

 

 

 

 

 

 

0

50

100

150

200

250

 

 

 

Input value

 

 

value

250

 

 

 

 

 

200

 

 

 

 

 

 

 

 

 

 

 

Output

150

 

 

 

 

 

100

 

 

 

 

 

 

 

 

 

 

 

 

50

 

 

 

 

 

 

0

 

 

 

 

 

 

0

50

100

150

200

250

 

 

 

Input value

 

 

value

250

 

 

 

 

 

200

 

 

 

 

 

 

 

 

 

 

 

Output

150

 

 

 

 

 

100

 

 

 

 

 

 

 

 

 

 

 

 

50

 

 

 

 

 

 

0

 

 

 

 

 

 

0

50

100

150

200

250

 

 

 

Input value

 

 

value

250

 

 

 

 

 

200

 

 

 

 

 

 

 

 

 

 

 

Output

150

 

 

 

 

 

100

 

 

 

 

 

 

 

 

 

 

 

 

50

 

 

 

 

 

 

0

 

 

 

 

 

 

0

50

100

150

200

250

 

 

 

Input value

 

 

value

250

 

 

 

 

 

200

 

 

 

 

 

Output

150

 

 

 

 

 

100

 

 

 

 

 

 

 

 

 

 

 

 

50

 

 

 

 

 

 

0

 

 

 

 

 

 

0

50

100

150

200

250

Input value

FIGURE 23-12

392

The Scientist and Engineer's Guide to Digital Signal Processing

a. Original IR image

b. With grayscale transform

FIGURE 23-13

Grayscale processing. Image (a) was acquired with an infrared camera in total darkness. Brightness in the image is related to the temperature, accounting for the appearance of the warm human body and the hot truck grill. Image (b) was processed with the manual grayscale transform shown in Fig. 23-14c.

The image in Fig. 23-13a was acquired in total darkness by using a CCD camera that is sensitive in the far infrared. The parameter being imaged is temperature: the hotter the object, the more infrared energy it emits and the brighter it appears in the image. This accounts for the background being very black (cold), the body being gray (warm), and the truck grill being white (hot). These systems are great for the military and police; you can see the other guy when he can't even see himself! The image in (a) is difficult to view because of the uneven distribution of pixel values. Most of the image is so dark that details cannot be seen in the scene. On the other end, the grill is near white saturation.

The histogram of this image is displayed in Fig. 23-14a, showing that the background, human, and grill have reasonably separate values. In this example, we will increase the contrast in the background and the grill, at the expense of everything else, including the human body. Figure (b) represents this strategy. We declare that the lowest pixel values, the background, will have a relative contrast of twelve. Likewise, the highest pixel values, the grill, will have a relative contrast of six. The body will have a relative contrast of one, with a staircase transition between the regions. All these values are determined by trial and error.

The grayscale transform resulting from this strategy is shown in (c), labeled manual. It is found by taking the running sum (i.e., the discrete integral) of the curve in (b), and then normalizing so that it has a value of 255 at the

Chapter 23Image Formation and Display

393

 

1600

 

 

 

 

 

 

1400

a. Histogram

 

 

 

pixelsof

1200

background

 

 

 

 

1000

 

 

 

 

 

 

 

 

 

 

 

Number

800

 

 

 

 

 

600

 

 

 

 

 

 

 

 

 

 

 

 

400

 

human body

 

 

 

 

 

 

 

 

 

 

200

 

 

 

 

grill

 

0

 

 

 

 

 

 

0

50

100

150

200

250

Value of pixel

FIGURE 23-14

Developing a grayscale transform. Figure (a) is the histogram of the raw image in Fig. 23-13a. In (b), a curve is manually generated indicating the desired contrast at each pixel value. The LUT for the output transform is then found by integration and normalization of (b), resulting in the curve labeled manual in (c). In histogram equalization, the histogram of the raw image, shown in (a), is integrated and normalized to find the LUT, shown in (c).

16

14 b. Desired contrast

12

contrast

10

 

Desired

8

6

 

 

4

 

2

 

0

0

50

100

150

200

250

Value of pixel

 

250

 

 

 

 

 

 

 

 

from histogram

 

 

 

200

 

 

 

 

 

value

 

 

 

manual

 

 

150

 

 

 

 

 

Display

 

 

 

 

 

100

 

 

 

 

 

 

 

 

 

 

 

 

50

 

 

c. Output transform

 

 

0

 

 

 

 

 

 

0

50

100

150

200

250

Input value

right side. Why take the integral to find the required curve? Think of it this way: The contrast at a particular pixel value is equal to the slope of the output transform. That is, we want (b) to be the derivative (slope) of (c). This means that (c) must be the integral of (b).

Passing the image in Fig. 23-13a through this manually determined grayscale transform produces the image in (b). The background has been made lighter, the grill has been made darker, and both have better contrast. These improvements are at the expense of the body's contrast, producing a less detailed image of the intruder (although it can't get much worse than in the original image).

Grayscale transforms can significantly improve the viewability of an image. The problem is, they can require a great deal of trial and error. Histogram equalization is a way to automate the procedure. Notice that the histogram in (a) and the contrast weighting curve in (b) have the same general shape. Histogram equalization blindly uses the histogram as the contrast weighing curve, eliminating the need for human judgement. That is, the output transform is found by integration and normalization of the histogram, rather than a manually generated curve. This results in the greatest contrast being given to those values that have the greatest number of pixels.

394

The Scientist and Engineer's Guide to Digital Signal Processing

Histogram equalization is an interesting mathematical procedure because it maximizes the entropy of the image, a measure of how much information is transmitted by a fixed number of bits. The fault with histogram equalization is that it mistakes the shear number of pixels at a certain value with the importance of the pixels at that value. For example, the truck grill and human intruder are the most prominent features in Fig. 23-13. In spite of this, histogram equalization would almost completely ignore these objects because they contain relatively few pixels. Histogram equalization is quick and easy. Just remember, if it doesn't work well, a manually generated curve will probably do much better.

Warping

One of the problems in photographing a planet's surface is the distortion from the curvature of the spherical shape. For example, suppose you use a telescope to photograph a square region near the center of a planet, as illustrated in Fig. 23-15a. After a few hours, the planet will have rotated on its axis, appearing as in (b). The previously photographed region appears highly distorted because it is curved near the horizon of the planet. Each of the two images contain complete information about the region, just from a different perspective. It is quite common to acquire a photograph such as (a), but really want the image to look like (b), or vice versa. For example, a satellite mapping the surface of a planet may take thousands of images from straight above, as in (a). To make a natural looking picture of the entire planet, such as the image of Venus in Fig. 23-1, each image must be distorted and placed in the proper position. On the other hand, consider a weather satellite looking at a hurricane that is not directly below it. There is no choice but to acquire the image obliquely, as in (b). The image is then converted into how it would appear from above, as in (a).

These spatial transformations are called warping. Space photography is the most common use for warping, but there are others. For example, many vacuum tube imaging detectors have various amounts of spatial distortion. This includes night vision cameras used by the military and x-ray detectors used in the medical field. Digital warping (or dewarping if you prefer) can be used to correct the inherent distortion in these devices. Special effects artists for motion pictures love to warp images. For example, a technique called morphing gradually warps one object into another over a series of frames. This can produces illusions such as a child turning into an adult, or a man turning into a werewolf.

Warping takes the original image (a two-dimensional array) and generates a warped image (another two-dimensional array). This is done by looping through each pixel in the warped image and asking: What is the proper pixel value that should be placed here? Given the particular row and column being calculated in the warped image, there is a corresponding row and column in the original image. The pixel value from the original image is transferred to the warped image to carry out the algorithm. In the jargon of image processing, the row and column that the pixel comes from in the

Chapter 23Image Formation and Display

395

a. Normal View

N

S

b. Oblique View

N

S

FIGURE 23-15

Image warping. As shown in (a), a normal view of a small section of a planet appears relatively distortion free. In comparison, an oblique view presents significant spatial distortion. Warping is the technique of changing one of these images into the other.

original image is called the comes-from address. Transferring each pixel from the original to the warped image is the easy part. The hard part is calculating the comes-from address associated with each pixel in the warped image. This is usually a pure math problem, and can become quite involved. Simply stretching the image in the horizontal or vertical direction is easier, involving only a multiplication of the row and/or column number to find the comes-from address.

One of the techniques used in warping is subpixel interpolation. For example, suppose you have developed a set of equations that turns a row and column address in the warped image into the comes-from address in the original

396

The Scientist and Engineer's Guide to Digital Signal Processing

image. Consider what might happen when you try to find the value of the pixel at row 10 and column 20 in the warped image. You pass the information: row = 10, column = 20, into your equations, and out pops: comes-from row = 20.2, comes-from column = 14.5. The point being, your calculations will likely use floating point, and therefore the comes-from addresses will not be integers. The easiest method to use is the nearest neighbor algorithm, that is, simply round the addresses to the nearest integer. This is simple, but can produce a very grainy appearance at the edges of objects where pixels may appear to be slightly misplaced.

Bilinear interpolation requires a little more effort, but provides significantly better images. Figure 23-16 shows how it works. You know the value of the four pixels around the fractional address, i.e., the value of the pixels at row 20 & 21, and column 14 and 15. In this example we will assume the pixels values are 91, 210, 162 and 95. The problem is to interpolate between these four values. This is done in two steps. First, interpolate in the horizontal direction between column 14 and 15. This produces two intermediate values, 150.5 on line 20, and 128.5 on line 21. Second, interpolate between these intermediate values in the vertical direction. This produces the bilinear interpolated pixel value of 139.5, which is then transferred to the warped image. Why interpolate in the horizontal direction and then the vertical direction instead of the reverse? It doesn't matter; the final answer is the same regardless of which order is used.

a.

column

14

14.5

20

 

91

 

150.5

 

 

 

 

row

20.2

139.5

 

21

 

162

 

128.5

 

 

 

 

 

 

 

 

 

 

 

b.

15

210

91

value

 

col

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

row

95

210

95

162

FIGURE 23-16

Subpixel interpolation. Subpixel interpolation for image warping is usually accomplished with bilinear interpolation. As shown in (a), two intermediate values are calculated by linear interpolation in the horizontal direction. The final value is then found by using linear interpolation in the vertical direction between the intermediate values. As shown by the three-dimensional illustration in (b), this procedure uniquely defines all values between the four known pixels at each of the corners.

Соседние файлы в предмете Электроника