+ All Categories
Home > Documents > Image Printing and Display

Image Printing and Display

Date post: 23-Mar-2016
Category:
Upload: siusan
View: 57 times
Download: 2 times
Share this document with a friend
Description:
Image Printing and Display. Reproducing reality. Display. Images are meant to be viewed Television screen Computer monitor Cell phone display Newspaper Glossy magazine Overhead projector Display device will be characterized by pixel shape spatial resolution color depth. - PowerPoint PPT Presentation
44
Image Printing and Display Reproducing reality
Transcript
Page 1: Image Printing and Display

Image Printing and Display

Reproducing reality

Page 2: Image Printing and Display

Display Images are meant to be viewed

Television screen Computer monitor Cell phone display Newspaper Glossy magazine Overhead projector

Display device will be characterized by pixel shape spatial resolution color depth

Page 3: Image Printing and Display

Issues with Display A typical computer monitor will use square

pixels with a spatial resolution of 72 pixels per inch and a color depth of 32 bpp.

A black-and-white laser printer may use circular pixels with a resolution of 1200 pixels per inch and a color depth of 1 bpp.

Whenever a digital image is rendered for display, the characteristics and limitations of the output device must be considered in order to generate an image of sufficient fidelity.

Page 4: Image Printing and Display

Halftoning The central problem when printing is color depth

of the output device. How to achieve the illusion of large color depth using

output devices of low color depth? Color printers typically have 4 colors (CMYK) or 2 bpp. Laser printers have 1 color (1 bpp)

Halftoning is the process of reducing the color depth of a source image to the level of the output device while maintaining the illusion that the output device has the same color depth as the source. The eye integrates Generally buy color depth at the cost of resolution

Page 5: Image Printing and Display

Analog Halftoning In traditional, analog halftoning, a grayscale image is converted

into a binary image composed of a pattern of dots. The dots are arranged in a grid and are themselves of various sizes.

Figure 8.1 shows how black dots of various sizes printed on a white background can give the visual illusion of all shades of gray when viewed from an appropriate distance.

The 8-bit grayscale gradient of (a) is halftoned to a 1-bit approximation. While appearing to be a grayscale image, the image of part (b) is a 1 bpp halftone as depicted by the highlighted inset. Halftoning in this example gives a 1-bit output device the illusion of being an 8-bit device.

Page 6: Image Printing and Display

Analog Halftoning Traditional halftoning is a continuous domain or

analog process that is performed by projecting an image through an optical screen onto film. The surface of the optical screen is etched with lines in

such a way as to cause dots to appear on the film in correspondence with the source intensity.

Larger black dots appear in regions of dark intensity and smaller black dots in regions of bright intensity.

The spatial resolution of halftone systems is given as lines per inch (LPI), which measures the density of the etched lines on the optical screen.

Newsprint, for example, is typically printed at 85 LPI while glossy magazines are printed using 300 LPI halftone screens.

Page 7: Image Printing and Display

Digital Halftoning Digital halftoning, also known as dithering, is any binary

process that reduces the color depth of a source while maintaining the sources spatial resolution.

A binary process is any process that outputs one of two colors for every pixel. Digital halftoning differs from traditional halftoning since the

digital halftoning process is discrete and the spatial resolution of the source image and the output device are uniform.

Traditional halftoning takes place in the continuous domain and the spatial resolution of the output device is flexible since dot sizes are allowed to vary continuously.

The output device normally has a color depth of 1 bpp; hence the task is to convert a grayscale image into a binary image of the same dimensions.

Page 8: Image Printing and Display

Dithering The human visual system performs spatial integration (averaging)

of colors near the point of focus and hence the central idea of dithering is to ensure that the local average of all output samples is identical to its corresponding source sample.

Dithering increases the apparent color depth of an output device by carefully intermingling colors from some limited palette in such a way that when local regions are averaged they produce the desired colors. Figure 8.2 – left: various shades of gray generated by interweaving only black and

white, Figure 8.2 – right: various shade of green generated by interweaving only cyan and

yellow.

Page 9: Image Printing and Display

Thresholding A dithering technique. Generate a black or white sample

from an 8-bit source sample. A point processing technique The dimensions of the destination are the same as the source The result is dependent on the threshold The output must be binary and hence each source sample is

converted to either black or white by comparison to a threshold value tau.

9

Page 10: Image Printing and Display

Thresholding Thresholding rarely produces pleasing results and is solely dependent on

proper selection of the threshold value. The threshold is commonly set to the center of the source image’s dynamic range, which

for an 8-bit image equates to 128. While this threshold value is appropriate as a generic solution it does not produce good

results in many cases. Figure 8.3 illustrates the effect of choosing an incorrect threshold. An overexposed source

image is thresholded with a cutoff of 128 to obtain the binary image of (b). Nearly all of the grayscale values in the source exceed 128 and hence nearly all of the resulting binary output samples are converted to white. Choosing a threshold of 196 produces much better results as can be seen in Figure 8.3(c).

10

Page 11: Image Printing and Display

How to choose a good threshold? Adaptive thresholding, also known as dynamic

thresholding, is used to determine an appropriate threshold for a particular image.

Adaptive thresholding is typically based on a statistical analysis of an image’s histogram, and seeks to determine an optimal split between clusters of samples in the data distribution. The simplest adaptive thresholding technique is to

use either the average or median value of all source samples as the threshold.

Computing both the average and mean sample values requires one pass through the image data and hence incurs a small amount of overhead.

Page 12: Image Printing and Display

How to choose a good threshold? A more sophisticated alternative is to use is an iterative

technique uncovered by Ridler and Calvard. This algorithm locates a threshold that is midway between the means of the black and white samples in the histogram. Listing 8.1 gives a pseudocode description of the algorithm.

Page 13: Image Printing and Display

Local Thresholding Thresholding can also be done locally

This is a regional process Compute a threshold that is distinct for each individual sample.

The threshold is the average of the samples in the region Emphasizes local contrast but looses global contrast

13

Page 14: Image Printing and Display

14

Patterning Substitute a pattern for each source pixel

Each pattern corresponds to a single intensity level (the average of the samples in the pattern)

For an NxN pattern, there are N*N + 1 possible intensity levels The destination is N times larger than the source in width AND height

Consider the following 3x3 font pattern

Page 15: Image Printing and Display

Patterning Generates a binary image from a grayscale or color source by

increasing the resolution of the output in order to compensate for the decreased color depth. Patterning works by using a group of pixels in the display device to

represent a single pixel from the source image. The font patterns must be carefully chosen to avoid artificial patterns

from forming An NxN pattern can represent NxN+1 patterns. The font below is a clustered-dot pattern.

Each pattern in the sequence is obtained by changing one pixel Each pattern is a subset of the previous in the sequence

Page 16: Image Printing and Display

16

Patterning Example

33 113 23464 121 21992 133 245

1 4 82 4 83 5 9

Source image pixels scaled to thecorresponding font value

binary output image

G = (P – P%26)/26

Page 17: Image Printing and Display

Patterning

17

Page 18: Image Printing and Display

Random Dithering Random dithering, as its name implies, chooses the threshold value at

random from a uniform distribution of values in the dynamic range of the source.

This technique does maintain both the global intensity value and local intensity values over reasonably small neighborhoods. Consider a grayscale image having an average grayscale intensity of 100.

On average, the randomly selected threshold will fall below the pixel value approximately 100 out of every 255 samples, thus generating a white output, while about 155/255 percent of the thresholds will be above the pixel value and hence will likely generate a black output, thus maintaining the proper average intensity value at any dimensional scale.

Digital random thresholding is similar to a high quality printmaking technique known as mezzotinting. An artist roughens the surface of a soft metal printing plate with thousands of

small randomly located depressions or dots. The density of the dots within a local region determines the tonality of the

print. When the plate is covered with ink and pressed against canvas or paper, those regions with a high dot density produce areas of less intensity than those areas with few or no dots. random!

Page 19: Image Printing and Display
Page 20: Image Printing and Display

Dithering Matrices A dither matrix is a rectangular pattern of threshold values that seeks to

produce optimal output for a local region of the source. When dithering a WxH source image with a NxN dither matrix, the dithering

matrix is generally much smaller than the source and is therefore repetitively tiled to generate threshold values for every source sample.

Dither matrices correspond to pattern fonts since the thresholds generally correspond to the likelihood of a black pixel occurring in any one of the fonts.

Dither matrices are generally square and must be scaled to the color depth of the source.

Page 21: Image Printing and Display

Dither Matrices (Implementation)

Page 22: Image Printing and Display

Dither Matrices (Implementation)

Page 23: Image Printing and Display

23

Dither Matrix Example

33 45 88 123 200 210 222 255

45 51 93 113 173 221 233 240

12 61 87 120 188 200 235 254

3 43 73 152 193 199 221 223

0 23 55 135 199 200 210 201

0 10 21 110 183 173 198 177

0 3 2 32 18 98 100 123

0 0 0 1 12 33 73 110

255 0

0 0

0 128

192 64

Position the dither matrix at the upper-left and compute the outputs using matrix entries as threshold values.

Page 24: Image Printing and Display

24

Dither Matrix Example

33 45 88 123 200 210 222 255

45 51 93 113 173 221 233 240

12 61 87 120 188 200 235 254

3 43 73 152 193 199 221 223

0 23 55 135 199 200 210 201

0 10 21 110 183 173 198 177

0 3 2 32 18 98 100 123

0 0 0 1 12 33 73 110

255 0 255 0

0 0 0 255

0 128

192 64

Move the matrix and repeat.

Page 25: Image Printing and Display

25

Dither Matrix Example

33 45 88 123 200 210 222 255

45 51 93 113 173 221 233 240

12 61 87 120 188 200 235 254

3 43 73 152 193 199 221 223

0 23 55 135 199 200 210 201

0 10 21 110 183 173 198 177

0 3 2 32 18 98 100 123

0 0 0 1 12 33 73 110

255 0 255 0 255 255

0 0 0 255 0 255

0 128

192 64

Move the matrix and repeat.

Page 26: Image Printing and Display

Dithering

3x3 Ordered Dither 4x4 Ordered Dither

26

Page 27: Image Printing and Display

Error Diffusion The ‘error’ between the source and

destination is used to adjust the threshold as the source image is scanned

The error is then pushed into unprocessed nearby samples in order to make sure that the ‘correct’ percentage of black/white pixels are generated locally.

27

Page 28: Image Printing and Display

Floyd-Steinberg Diffusion Various ways of diffusing the error Floyd-Steinberg takes the error and distributes

it using the ratios given below Remember that we are doing a raster scan.

Samples above and to the left have already been processed.

28

Page 29: Image Printing and Display

29

Floyd-Steinberg Example

35 89 95 132

68 112 100 150

51 45 98 127

0 ? ? ?

? ? ? ?

? ? ? ?

35 104 95 132

79 114 100 150

51 45 98 127

35 89 95 132

68 112 100 150

51 45 98 127

15

11 2

35/16 = 2.1875

Page 30: Image Printing and Display

30

Floyd-Steinberg Example

0 0 ? ?

? ? ? ?

? ? ? ?

35 104 95 132

79 114 100 150

51 45 98 127

104/16 = 6.5

35 104 95 132

79 114 100 150

51 45 98 127

35 104 141 132

99 147 106 150

51 45 98 127

46

20 33 6

Page 31: Image Printing and Display

31

Floyd-Steinberg Example

0 0 255 ?

? ? ? ?

? ? ? ?

35 104 141 132

99 147 106 150

51 45 98 127

-114/16 = -7.12535 104 141 132

99 147 106 150

51 45 98 127

35 104 141 82

99 126 70 143

51 45 98 127

-50

-21 -36 -7

Page 32: Image Printing and Display

32

Floyd-Steinberg Example

12798455115010011268132958935

Input Image

25500025502550025500

Output Image

Note that this is not an in-place algorithm. Extra storage is required! (i.e. copy the input image and then manipulate the copy)

The sum of all gray levels in the input is 1102. The sum of all values in the output is 1020. The average per-pixel error is –6.83

Page 33: Image Printing and Display

Other diffusion techniques Other techniques diffuse the error using

different weights or ratios. The black square corresponds to the source

sample being processed

33

Page 34: Image Printing and Display

Error Diffusion Examples

Floyd-Steinberg Jarvis-Judice-Ninke

34

Page 35: Image Printing and Display

Error Diffusion Examples

Stucki Sierra

35

Page 36: Image Printing and Display

What about color images? How to reduce a 24 bpp image to a 1 bpp?

Extract the brightness band and halftone it. How to reduce a 24 bpp image to N bpp?

Some devices have only 4 colors (CMYK color printers)

Some devices have only 216 or 256 total colors available Thin web clients and web-safe palette (216 colors) Conversion to an indexed color model would limit to 256

colors

Can use error diffusion!

Page 37: Image Printing and Display

37

Color Dithering Given a color palette (i.e. the colors supported

by the output device) perform a color dither.

Page 38: Image Printing and Display

Stucki

Page 39: Image Printing and Display

Stucki with 16 color paletteStucki with 8 color palette

Page 40: Image Printing and Display

Stucki with web-safe paletteSource image

Page 41: Image Printing and Display

Color Dithering GIF images contain at most 256 different colors

Uses an indexed color model of sorts The image has been dithered

What if a GIF image is being viewed on a system that supports a color palette of 64 colors?

What if the viewers color palette is different that GIF’s color palette?

The image is “dithered” twice and quickly deteriorates. GIF images are highly compressed, but lack quality!

GIFDither

DisplayDither

41

Page 42: Image Printing and Display

Color Dithering Dithering assumes a pre-defined palette that corresponds

to the ability of the output to reproduce colors Consider GIF files

Must construct an arbitrary palette of 256 colors Must then perform color dithering What is the ‘optimal’ palette?

42

Page 43: Image Printing and Display

Median Cut Median cut

A clustering algorithm Used to identify clusters of data points Used in the context of color palettes, identifies N

clusters of colors in some color space

• Find the smallest box which contains all the colors in the image• Find the box having the longest length on any one side

• Sort the colors in the box along the longest box axis.• Split the box into 2 at the median of the sorted list. • Repeat until the original color space has been divided into n

boxes. Each box represents a color. The color is the average color of all contained colors

43

Page 44: Image Printing and Display

Median Cutalgorithm createPalette(Image IM, int PaletteSize) B = smallest bounding box of all colors in IM PQ = new PriorityQueue() PQ.add(B, B.maxDimension()) while(PQ.size() != PaletteSize) { B = PQ.remove(); (B1,B2) = B.cut(); PQ.add(B1,B1.maxDimension()) PQ.add(B2,B2.maxDimension()) } return PQ.toArray();}

44


Recommended