Half Toning Color Half Toning 1
Color Half Toning 2
Half Toning Emulating 5 different levels (0) (1) (2) (3) (4) (0) (1) (2) (3) (0) (1) (2) (3) (4) Half Toning (2) (0) (1) (3) (4) (7) (5) (6) (8) (9) 10 levels 3
4
Dithering and Halftoning Trade spatial for intensity resolution (works well for printing where dot printing is very high) • Thresholding. • Random dither; Robert’s algorithm • Ordered dither • Error diffusion Your eye will average over an area - Spatial Integration 5
Thresholding Assume we want to quantize a gray-level image to a binary colormap. Map the upper half of the gray-level scale to white, and the lower half to black – a simple threshold operation, preformed independently at each pixel. Thresholding. Simple threshold. n = 0.5 n = 0.7 Original image. � v ( x , y ) trunc ( v ( x , y ) n ) Errors are low spatial frequencies. � � 6
Robert’s Algorithm • First add noise v � ( x , y ) trunc ( K v ( x , y ) noise ( x , y )) � � � • Then quantize 0 1 � noise � i r + 1 1 Quantised to 1 Quantised to 0 r 0 x Moves errors to higher spatial frequencies. -> eye averages over an area. Robert’s Algorithm Moves low frequency (average error) to high frequency Pink(low), Blue (high) , White(all) frequency noise Pink Blue 7
The trouble with noise. • Difficult to compute quickly. • Not reproducible. • Pre-compute pseudo-random function and store in table. • Small tiled patterns sufficient 8
Dithering Each pixel produces a quatization error The quality of the result may be improved by adjusting the threshold locally, so that adjacent pixels in small areas are quantized with different thresholds. This reduces the average local quantization error. Matrices of these threshold are called dither matrices. Comparison 9
Ordered Dithering • Trade off spatial resolution for intensity resolution. • Use dither patterns. • Can be represented as a matrix. Bayer Ordered Dither Patterns 10
Other possibilities. The dithering matrix (3x3) 3 7 5 6 1 2 9 4 8 For all Xpixels For all Ypixels v = approximate(x,y) i = x mod m j = y mod n if v >= M[i,j] then Set_Pixel(x,y, BLACK) else Set_Pixel(x,y, WHITE) 11
Dithering 3 7 5 3 7 5 6 1 2 Dithering mask 6 1 2 9 4 8 9 4 8 3 7 7 5 5 8 1 6 2 4 5 3 2 2 1 3 Image 6 6 8 1 2 7 2 2 5 4 3 2 3 2 2 3 9 9 4 4 8 8 4 3 7 5 2 6 4 4 8 4 3 3 8 7 9 5 7 7 2 2 1 3 2 0 0 1 6 6 9 1 2 2 9 7 4 3 2 2 4 Binary image 0 1 1 9 9 4 4 8 8 8 8 4 4 8 4 4 0 1 1 Comparison. 12
Floyd-Steinberg Error Diffusion With this method, the average quatization error is reduced by propagating the error from each pixel to some of its neighbors in the scan order. -3e/8 e -e/4 -3e/8 Note that the error propagation weights must sum to one Dither vs. Floyd-Steinberg 13
Error Diffusion Set AccErr[] to zero; For each pixel in the image scanning from left to right: value= Pixel_value(x,y) + AccErr[x,y]; if (value > WHITE/2) { Set_pixel(x,y, WHITE); Error = value - WHITE; } else { Set_pixel(x,y, BLACK); Error = value - BLACK; } if scanning from left to right { AccErr[x+1, y] += 3/8 * Error; AccErr[x, y+1] += 3/8 * Error; AccErr[x+1,y+1] += 2/8 * Error; } 14
15
Median Cut 16
Median Cut Median Cut 17
Median Cut Median Cut 18
Median Cut 19
A better solution 20
Median Cut 8 indexed colored Original image 21
8 indexed colored 32 indexed colored 128 indexed colored Original image 22
8 levels per channel that is, 9 bits per pixel 23
Recommend
More recommend