Presentation is loading. Please wait.

Presentation is loading. Please wait.

Image Printing and Display

Similar presentations


Presentation on theme: "Image Printing and Display"— Presentation transcript:

1 Image Printing and Display
Reproducing reality

2 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

3 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.

4 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

5 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.

6 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.

7 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.

8 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.

9 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.

10 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).

11 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.

12 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.

13 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

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

15 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

16 corresponding font value
Patterning Example G = (P – P%26)/26 1 4 8 2 3 5 9 33 113 234 64 121 219 92 133 245 Source image pixels scaled to the corresponding font value binary output image

17 Patterning

18 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 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!

19

20 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.

21 Dither Matrices (Implementation)

22 Dither Matrices (Implementation)

23 Dither Matrix Example 128 192 64 33 45 88 123 200 210 222 255 51 93 113 173 221 233 240 12 61 87 120 188 235 254 3 43 73 152 193 199 223 23 55 135 201 10 21 110 183 198 177 2 32 18 98 100 1 255 Position the dither matrix at the upper-left and compute the outputs using matrix entries as threshold values.

24 Dither Matrix Example Move the matrix and repeat. 128 192 64 33 45 88
128 192 64 33 45 88 123 200 210 222 255 51 93 113 173 221 233 240 12 61 87 120 188 235 254 3 43 73 152 193 199 223 23 55 135 201 10 21 110 183 198 177 2 32 18 98 100 1 255 Move the matrix and repeat.

25 Dither Matrix Example Move the matrix and repeat. 128 192 64 33 45 88
128 192 64 33 45 88 123 200 210 222 255 51 93 113 173 221 233 240 12 61 87 120 188 235 254 3 43 73 152 193 199 223 23 55 135 201 10 21 110 183 198 177 2 32 18 98 100 1 255 Move the matrix and repeat.

26 Dithering 3x3 Ordered Dither 4x4 Ordered Dither

27 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.

28 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.

29 Floyd-Steinberg Example
35 89 95 132 68 112 100 150 51 45 98 127 ? 35 89 95 132 68 112 100 150 51 45 98 127 15 11 2 35 104 95 132 79 114 100 150 51 45 98 127 35/16 =

30 Floyd-Steinberg Example
35 104 95 132 79 114 100 150 51 45 98 127 ? 35 104 95 132 79 114 100 150 51 45 98 127 46 20 33 6 35 104 141 132 99 147 106 150 51 45 98 127 104/16 = 6.5

31 Floyd-Steinberg Example
35 104 141 132 99 147 106 150 51 45 98 127 255 ? 35 104 141 132 99 147 106 150 51 45 98 127 -50 -21 -36 -7 35 104 141 82 99 126 70 143 51 45 98 127 -114/16 =

32 Floyd-Steinberg Example
The sum of all gray levels in the input is The sum of all values in the output is The average per-pixel error is –6.83 127 98 45 51 150 100 112 68 132 95 89 35 Input Image 255 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)

33 Other diffusion techniques
Other techniques diffuse the error using different weights or ratios. The black square corresponds to the source sample being processed

34 Error Diffusion Examples
Floyd-Steinberg Jarvis-Judice-Ninke

35 Error Diffusion Examples
Stucki Sierra

36 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!

37 Color Dithering Given a color palette (i.e. the colors supported by the output device) perform a color dither.

38 Stucki

39 Stucki with 8 color palette Stucki with 16 color palette

40 Stucki with web-safe palette
Source image Stucki with web-safe palette

41 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! GIF Dither Display Dither

42 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?

43 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

44 Median Cut algorithm 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();


Download ppt "Image Printing and Display"

Similar presentations


Ads by Google