source: www/study/part5.html @ 2030

Last change on this file since 2030 was 2030, checked in by Sam Hocevar, 13 years ago
  • Started part 6: Photographic mosaics.
File size: 5.0 KB
Line 
1<?php header("Content-Type: text/html; charset=utf-8"); ?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
3       "http://www.w3.org/TR/xhtml1/DTD/xhtml11.dtd">
4
5<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
6
7<head>
8   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9   <meta name="GENERATOR" content="vim" />
10   <meta name="Author" content="sam@zoy.org (Sam Hocevar)" />
11   <meta name="Description" content="Libcaca study" />
12   <meta name="Keywords" content="libcaca, ASCII, ASCII ART, console, text mode, ncurses, slang, AAlib, dithering, thresholding" />
13   <title>Libcaca study</title>
14   <link rel="icon" type="image/x-icon" href="/favicon.ico" />
15   <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
16   <link rel="stylesheet" type="text/css" href="/main.css" />
17</head>
18
19<body>
20
21<?php include($_SERVER["DOCUMENT_ROOT"]."/header.inc"); ?>
22
23<p> <span style="color: #aa0000; font-weight: bold;">Warning</span>: this
24document is still work in progress. Feel free to send comments but do not
25consider it final material. </p>
26
27<div style="float: left;">
28   <a href="part4.html">Grayscale dithering &lt;&lt;&lt;</a>
29</div>
30<div style="float: right;">
31   <a href="part6.html">&gt;&gt;&gt; Photographic mosaics</a>
32</div>
33<div style="text-align: center;">
34   <a href="index.html">^^^ Index</a>
35</div>
36
37<h2> 5. Colour dithering </h2>
38
39<p> Dithering colour images means dithering three-dimensional elements (RGB
40pixels) instead of one-dimensional gray values. It is very complex and
41depends on the output media even more than grayscale dithering. </p>
42
43<h3> 5.1. Separate-space dithering </h3>
44
45<p> In some cases it is possible to perform three one-dimensional dithering
46operations instead of one three-dimensional one. Consider for instance the
47following palette:
48</p>
49
50<p style="text-align: center;">
51  <img src="pat5-1-1.png" width="512" height="64"
52       class="inline" alt="8-colour RGB palette" />
53</p>
54
55<p> It is made of the eight possible red/green/blue combinations made of 0.0
56and 1.0 values. So one way of dithering an image using this palette is to
57convert the image into three grayscale images (separating the red, green and
58blue channels), dither each subimage to two colours separately and recombine
59the images into three channels. </p>
60
61<p> Here are the results with Floyd-Steinberg dithering applied to each
62channel. On the left, no colour correction, as The Gimp or Photoshop would
63do; on the right, gamma-corrected dithering: </p>
64
65<p style="text-align: center;">
66  <img src="out5-1-1.png" width="256" height="256"
67       class="inline" alt="Floyd-Steinberg, 8 colours" />
68  <img src="out5-1-2.png" width="256" height="256"
69       class="inline" alt="Floyd-Steinberg, 8 colours, gamma-corrected" />
70</p>
71
72<h3> 5.2. Accounting for other dimensions </h3>
73
74<p> The following patterns show four ways to dither the same colour using
75our 8-colour palette. The first one mixes black, blue and white pixels. The
76second one mixes black, blue and yellow pixels. The third one mixes black,
77blue, cyan and red pixels. The last one mixes black, blue, green and red
78pixels. All patterns visually blend to the same shade, but the last one is
79the most visually appealing: </p>
80
81<p style="text-align: center;">
82  <img src="pat5-2-1.png" width="320" height="160"
83       class="inline" alt="3 ways to dither the same colour" />
84</p>
85
86<p> It is therefore quite clear that the exact pixel values matter much less
87than visual artifacts. Here is a close-up of the previous output’s top-left
88corner. The slanted bright pixel lines that appear are typical Floyd-Steinberg
89artifacts. They are rendered even worse by the fact that dithering is done on
90three different dimensions that do not take the others into account: </p>
91
92<p style="text-align: center;">
93  <img src="out5-2-1.png" width="32" height="32"
94       class="inlinetop" alt="Floyd-Steinberg, 8 colours, gamma-corrected, cropped" />
95  <img src="out5-2-2.png" width="192" height="192"
96       class="inline" alt="Floyd-Steinberg, 8 colours, gamma-corrected, cropped, zoomed" />
97</p>
98
99<p> Some algorithms perform a bit better in this area. This is Stucki
100dithering. The Floyd-Steinberg artifacts are much less visible: </p>
101
102<p style="text-align: center;">
103  <img src="out5-2-3.png" width="256" height="256"
104       class="inline" alt="Stucki, 8 colours, gamma-corrected" />
105</p>
106
107<p> And this is a close-up of the same area: </p>
108
109<p style="text-align: center;">
110  <img src="out5-2-4.png" width="32" height="32"
111       class="inlinetop" alt="Stucki, 8 colours, gamma-corrected, cropped" />
112  <img src="out5-2-5.png" width="192" height="192"
113       class="inline" alt="Stucki, 8 colours, gamma-corrected, cropped, zoomed" />
114</p>
115
116<div style="float: left;">
117   <a href="part4.html">Grayscale dithering &lt;&lt;&lt;</a>
118</div>
119<div style="float: right;">
120   <a href="part6.html">&gt;&gt;&gt; Photographic mosaics</a>
121</div>
122<div style="text-align: center;">
123   <a href="index.html">^^^ Index</a>
124</div>
125
126<?php $rev = '$Id$';
127      include($_SERVER['DOCUMENT_ROOT'].'/footer.inc'); ?>
128
129</body>
130</html>
Note: See TracBrowser for help on using the repository browser.