half toning. continuous half toning color half toning
Post on 24-Jan-2016
248 views
TRANSCRIPT
Half Toning
Continuous Half Toning
Color Half Toning
Half toning and Colors
Digital Half Toning
(0) (1) (2) (3) (4)
(0) (1) (2) (3)
(0) (1) (2) (3) (4)
Emulating 5 different levels
Half Toning
(0) (1) (2) (3) (4)
(5) (6) (7) (8) (9)
Half Toning
10 levels
Original
Half Toning
Original
Dithering
Dithering and HalftoningTrade spatial for intensity resolution(works well for printing where dot printing is very
high)• Thresholding. • Random dither; Robert’s algorithm• Ordered dither• Error diffusionYour eye will average over an area
- Spatial Integration
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.
ThresholdingOriginal image. Simple threshold. n = 0.5
)),((),( nyxvtruncyxv Errors are low spatial frequencies.
Robert’s Algorithm
• First add noise
• Then quantize
x
i
0
1
r
r + 1Quantized to 1
Quantized to 0
)),(),((),( yxnoiseyxvKtruncyxv
10 noise
Moves errors to higher spatial frequencies.-> eye averages over an area.
Threshold
Threshold + Noise
Robert’s Algorithm
Pink Blue
The trouble with noise
• Difficult to compute quickly.
• Not reproducible.
• Pre-compute pseudo-random function and store in table.
• Small tiled patterns sufficient
Dithering
• It is possible to improve the quality of a quantized image by distributing the quantized error.
• Let’s have a closer look.
Dithering
Thresholding 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.
Dithering
Threshold + Noise
Dithering
Ordered Dithering
• Trade off spatial resolution for intensity resolution.
• Use dither patterns.
• Can be represented as a matrix.
Other possibilities
9 4 8
6 1 2
573
For all Xpixels For all Ypixels v = approximate(x,y) i = x mod 3 j = y mod 3 if v >= M[i,j] then Set_Pixel(x,y, BLACK) else Set_Pixel(x,y, WHITE)
The dithering matrix (3x3)
Dithering
9 4 8
6 1 2
573
9 4 8
6 1 2
573
9 4 8
6
1
2
5
73
9 4 8
6 1 2
573
9 4 8
6
157
3
2 5
54
4
4
2
2
2
2 2
3
3
3
3
6
8 444
4
2
28 3
8
8
9
9
9
8 8
7
7
7
7
6
4
2
4
4
2
2
12
2 2
3
3
8 44
9 4 8
6 1 2
573
0 1 0
0 1 1
000
Dithering mask
Image
Binary image
Original
Dithering
Dithering
Error Diffusion
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.
1D Error Diffusion
0
1
1
1D Error Diffusion
0
1
1D Error Diffusion
0
1
1D Error Diffusion
0
1
1D Error Diffusion
0
1
01
1D Error Diffusion
0
1
01 1
1D Error Diffusion
0
1
1D Error Diffusion
0
1
1D Error Diffusion
0
1
Floyd-Steinberg Error DiffusionWith this method, the average quatization error is reduced by propagating the error from each pixel to some of its neighbors in the scan order.
Note that the error propagation weights must sum to one
e -3e/8
-3e/8 -e/4
e-3e/8
-3e/8-e/4
Dither vs. Floyd-Steinberg
Original Picture
Dithering resultError diffusion result
Examples – Continue
DitheringDithering:
Note that each square ring is of different brightness
Error Diffusion
Error Diffusion:
Note that the error is distributed across the layers
Examples – ContinueOriginal:
Dithering
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; }
Error Diffusion
Space Filling Curves • order of scan
Space Filling Curves
Hilbert curve(1-4)
Space Filling Curves
Hilbert curve(1-4)
Space Filling Curves
Hilbert curve(1-4)
Space Filling Curves
Hilbert curve(1-4)
Space Filling Curves
Peano curve
Context Based SFC
Original Image
Threshholding
Bayer’s Ordered Dithering
Error Diffusion
Median Cut (4 levels)
Median Cut (8 levels)