Title: Halftoning
1Halftoning
- Halftoning problem
- Full-color image
- Few-color display device
- usually 2 colors black and white
- input full color image
- output reduced-color image
- Ancient Solutions!
2Fixed Threshold
- Given
- in (x,y) input image
- S set of output colors, usually S0,1
- out (x,y) c?S, minimum c - in(x,y)
- out(x,y) 0, if in(x,y) lt 1/2
- 1, if gt 1/2
3Random Threshold
- Given
- in (x,y) input image
- S set of output colors, usually S0,1
- out (x,y) pick r random (0 to 1)
- out(x,y) 0, if in(x,y) lt r
- 1, if gt r
4Comparison
- Fixed Threshold
- sharp edges preserved
- no gray information
- Random Threshold
- noisy edges
- more gray information
5Color Reduction Problem
- Print continuous-tone images
- image colors gtgt device colors
- eg laser printer colors 2
Continuous tone
Fixed threshold
Random threshold
6Fixed Threshold
7Random Threshold
81695 Mezzotint
9Basic Principle
- Trade off
- color detail vs spatial detail
- Why?
- eye integrates nearby pixels
- sees gray
10Halftoning
- Two basic types
- Ordered dither
- Bayer, Clustered-dot
- matrices of thresholds
- Error diffusion
- Floyd-Steinberg, Stucki
- process pixel, adjust neighbors
11Halftoning
original
ordered
clustered
Error diffusion
12Ordered Dither
- Many different thresholds
- Threshold depends on (x y)
- Random Threshold
- image looks grainy
- Repeated Thresholds
- visible repeated pattern
13Ordered Dither
- Group pixels into blocks
- eg 2x2 block
- 5 gray levels
- Algorithm
- i x mod n, j y mod ne int( in(x,y)
n2)out(x,y) 0 if e gt M(i,j)
1 if e lt M(i,j)
3
1
0
2
14Which Matrix?
- Bad matrices
- linear artifacts
- consecutive entries are nearby in matrix
- Good matrices
- consecutive entries are far apart
0
1
2
3
4
5
6
7
8
0
3
6
1
4
7
2
5
8
15Bayers Matrices
- Bayer 1976
- (2n x 2n)
- Defined recursively
3
1
2x2
0
2
15
7
13
5
3
11
1
9
4x4
12
4
14
6
0
8
2
10
16Ordered Dither Example
input
output
detail
17Dispersed-dot Ordered Dither
18Dispersed-dot synthetic image
191844 Jacquard Loom Weaving
20Clustered-Dot Dither
- Commercial printing
- cant print tiny isolated dots
- use bigger dots
- less spatial resolution
- spiral threshold pattern
14
8
9
15
7
1
2
10
4x4
6
0
3
11
13
5
4
12
21Newspaper Image
22Hand-made Stippling
23Color Clustered Dot
- Square grid of dots very evident
- 45-degree grid less evident
- 4 inks Cyan, Magenta, Yellow, Black
- overlaps moire patterns
- rotate colored inks
- less moires
24Four-Color Printing
yellow
cyan
magenta
black
25Printed Result
26Space-Filling Curve
- Hilbert Curve
- consecutive locations nearby
- like clustered-dot
- dots not round
27Space-Filling Curve
- 4x4 matrix
- 17 gray levels
28Space-Filling Curve
Test Gray Ramps
29Halftoning
- Two basic types
- Ordered dither
- Bayer, Clustered-dot
- matrices of thresholds
- Error diffusion
- Floyd-Steinberg, Stucki
- process pixel, adjust neighbors
30Error Diffusion
- Problem fixed threshold 0 or 1
- info lost error
- overall tone of image incorrect
- Solution use the error
- give it to pixels neighbor
31Floyd-Steinberg
processed
- Algorithm (? ? ? ?1)
- out(x,y) closest to in(x,y)
- e in(x,y) - out(x,y)
- in(x1, y) ? e
- in(x-1,y1) ? e
- in(x, y1) ? e
- in(x1,y1) ? e
?
?
?
?
? 7/16? 3/16? 5/16? 1/16
32Error Diffusion
33Error Diffusion Synthetic image
34Error Diffusion
- Problems
- worms advancing error front
- blurring
- Solutions
- bidirectional processing
- pre-filtering
- wider kernel (spread error further)
- Stucki
35Random-Dot Error Diffusion
- Problem
- Color dot positions known
- Assign colors
- Challenge
- dots not on a grid
- Approach
- error diffusion on graph
36The Approach (2)
- Random-dot F-S
- nearest dot neighbors
- in what order?
- Floyd-Steinberg (F-S)
- pixel neighbors
- scanline order
- Dot-processing orders investigated
- get nearest-neighbor graph, traverse
- depth-first
- breadth first
- error-driven (choose from frontier dots)
- hybrids
37Original Dots
38Points (dot centers)
39Dots and Neighbors (Delaunay Triangulation)
40Pixel Graphs
(Pixels have neighbors too)
used by F-S
4-neighbors
diagonal neighbors
8-neighbors
41The Algorithm
- Visit Dots in some order
- for each dot
- set to closest color in set
- (color changed ? error)
- add error to neighbors
42Visit dots in What order?
- dots nodes in graph
- visit dots traverse graph
- depth-first graph traversal?
- breadth-first?
- other?
43Depth-first graph traversal
- Stack stores advancing front
- push node on stack
- while (stack not empty) node ? top of
stack process node (color it) for each
neighbor of node push neighbor on
stack
44Breadth-first graph traversal
- Queue stores advancing front
- push node on queue
- while (queue not empty) node lt head of
queue process node for each neighbor of
node append neighbor on queue
45Error-driven traversal
- Front set of candidate dots
- add node to front
- while (front not empty) choose node from
front (min, max, or median error)
process node for each neighbor of node
add neighbor to front
46Gray Ramp Test (8-neighbor graph)
Gray ramp
Depth-first(DFS)
Breadth-first(BFS)
25 BFS 75 DFS
47Use Hybrid Traversal
- Error-driven traversal looks horrible!
- too ugly to show
- Breadth-first and Depth-first show artifacts
- Hybrid
- queue of pixels, random variable x (0 ? x ?
1) - if (x ? 1/4) get pixel from head of queue
- if (x gt 1/4) get pixel from tail of queue
48Pointillism simulation
- Restricted set of colors
- Dots are paint strokes
- Assume dot positions are known
49Seurats Pointillism
Original
Simulation
50Luces Pointillism
Original
Simulation
51Color Stippling
52Application Color Printing
- 4-color offset printing
- dots overlap
- loss of saturation
- random-dot halftoning color stippling
- dots dont overlap
- brighter colors
53Comparison
Standard 4-color printing
Error diffusion on adjacency graph
54Comparison
Sharper, more saturated
4-color printing
55Restricted Mosaic
- Simulated tiles
- tile color underlying image
- many colors possible
- Actual tiles
- limited color choice
- must use halftone
- Dots are square!
- use area voronoi diagram to get graph
56Restricted-color Mosaic
Continuous color
27 tile colors
57Better-chosen colors
2000 tile colors
8 tile colors
58Graph-Order Dither
- Generalizes Bayers Dither
- Pixels in arbitrary positions
- Problem
- Given n points in 2D,find visitation order,with
consecutive points far apart
59Dispersed-Dot Dither
- Bayer (1976)
- Threshold Matrix (2n x 2n)
- replicated across image
- 4 x 4 matrix
- 0 8 2 10
- 12 4 14 6
- 3 11 1 9
- 15 7 13 5
60Consecutive Separation
- 0 8 2 10
- 12 4 14 6
- 3 11 1 9
- 15 7 13 5
- Consecutive entries (eg 12, 13) far apart
- Yields intermediate tones (grays)
- Avoids clusters
61The Problem
- Matrix Dots on square grid
- Random Dots no grid
- Problem Given dots in 2D, order them so
that consecutive points are far apart.
62Algorithm
- Color nodes
- Pick one color
- Color only those nodes
- Repeat
63A Graph
node
node
arc
64Colored Graph
arcs join adjacent nodes every two
adjacent nodes get different colors
65Single-Color Separation
red nodes far apart
66Colored Graph
67Single-Color Separation
green nodes far apart
68Colored Graph
69Single-Color Separation
blue nodes too
70Colored Graph
71Single-Color Separation
and yellow too
72Repeat
pick one color
73Repeat
build neighbor graph
74Repeat
color again yellow nodes even farther apart than
before
75Repeat Recursively
22
111
1 yellow 2 blue 3 green 4 red
322
211
13
31
42
12
23
33
212
41
321
112
76Sort Labels
22
111
lexicographic order 1 111 2 112 3
12 4 13 5 211 6 212 7 22 8
23 9 31 10 321 11 322 12 33 13 41 14
42
322
211
13
31
42
12
23
33
212
41
321
112
77Consecutive Separation
7
1
lexicographic order 1 111 2 112 3
12 4 13 5 211 6 212 7 22 8
23 9 31 10 321 11 322 12 33 13 41 14
42
11
5
4
9
14
3
8
12
6
13
10
2
78Algorithm
- label(S) //
s set of points construct G(S)
// G(S) neighbor graph color
vertices with k colors for j 1 to k
// for each color Sj
points with color j append j to all
labels in Sj label (Sj) - sort all labels in lexicographic order
79Properties
- consecutive points far apart
- many orderings of same points
- each graph has many colorings
- points need not be on grid
80Applications
- Dithering without repetitive artifacts
- use many different dither matrices
81Applications
- Artistic Screening
- usual goal hide artifacts
- repeated matrix repetitive artifact
- artistic goal artifact art
- repeated matrix decorative pattern
82input
dither matrix
detail
83input
26 dither matrices
detail
84Application
- Dither with shapes
- collection of shapes
- can get neighbor graph
- hierarchical coloring
85input
shapes