Changeset 2186
- Timestamp:
- 01/03/08 01:47:44 (5 years ago)
- Location:
- www/study
- Files:
-
- 7 added
- 3 edited
-
grad5-1-1.png (added)
-
grad5-1-2.png (added)
-
grad5-2-1.png (added)
-
grad5-2-2.png (added)
-
grad5-2-3.png (added)
-
grad5-2-4.png (added)
-
gradient256.png (added)
-
index.html (modified) (2 diffs)
-
part5.html (modified) (3 diffs)
-
study.py (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
www/study/index.html
r2181 r2186 46 46 <p> Meet Lenna. She will guide us through this document, because the 47 47 seriousness of a scientific document in the area of computer graphics can 48 be measured by the number of times Lenna appears in it. </p> 48 be measured by the number of times Lenna appears in it. She truly is the 49 <i>Mona Lisa</i> of image processing. </p> 49 50 50 51 <p style="text-align: center;"> 51 52 <img src="lenna256.png" width="256" height="256" 52 53 class="inline" alt="Lenna (256×256)" /> 54 <img src="gradient256.png" width="64" height="256" 55 class="inline" alt="colour gradient (64×256)" /> 53 56 <img src="lenna256bw.png" width="256" height="256" 54 57 class="inline" alt="Lenna (256×256BW)" /> 55 58 <img src="gradient256bw.png" width="32" height="256" 56 class="inline" alt="gr adient" />59 class="inline" alt="greyscale gradient (32×256)" /> 57 60 </p> 58 61 … … 76 79 77 80 <ul> 78 <li> <a href="part1.html">1. Colour quantisation</a> </li> 79 <li> <a href="part2.html">2. Halftoning patterns</a> </li> 80 <li> <a href="part3.html">3. Error diffusion</a> </li> 81 <li> <a href="part4.html">4. Greyscale dithering</a> </li> 82 <li> <a href="part5.html">5. Colour dithering</a> </li> 83 <li> <a href="part6.html">6. Photographic mosaics</a> </li> 81 <li> <a href="part1.html">1. Colour quantisation</a> 82 <ul> 83 <li> 1.1. Black and white thresholding </li> 84 <li> 1.2. Greyscale thresholding </li> 85 <li> 1.3. Dynamic thresholding </li> 86 <li> 1.4. Random dithering </li> 87 </ul> 88 </li> 89 <li> <a href="part2.html">2. Halftoning</a> 90 <ul> 91 <li> 2.1. Halftoning patterns </li> 92 <li> 2.2. Screen artifacts </li> 93 <li> 2.3. Ordered dithering </li> 94 <li> 2.4. Random ordered dithering </li> 95 <li> 2.5. Non-rectangular dither tiles </li> 96 <li> 2.6. Supercell dithering </li> 97 <li> 2.7. Void and cluster method </li> 98 </ul> 99 </li> 100 <li> <a href="part3.html">3. Error diffusion</a> 101 <ul> 102 <li> 3.1. Floyd-Steinberg error diffusion </li> 103 <li> 3.2. Floyd-Steinberg derivatives </li> 104 <li> 3.3. Changing image parsing direction </li> 105 <li> 3.4. Variable coefficients error diffusion </li> 106 <li> 3.5. Block error diffusion </li> 107 <li> 3.6. Sub-block error diffusion </li> 108 </ul> 109 </li> 110 <li> <a href="part4.html">4. Greyscale dithering</a> 111 <ul> 112 <li> 4.1. Introducing gamma </li> 113 <li> 4.2. Gamma correction </li> 114 </ul> 115 </li> 116 <li> <a href="part5.html">5. Colour dithering</a> 117 <ul> 118 <li> 5.1. Separate-space dithering </li> 119 <li> 5.2. Accounting for other dimensions </li> 120 <li> 5.3. TODO </li> 121 </ul> 122 </li> 123 <li> <a href="part6.html">6. Photographic mosaics</a> 124 <ul> 125 <li> 6.1. Image classification </li> 126 </ul> 127 </li> 84 128 </ul> 85 129 -
www/study/part5.html
r2185 r2186 88 88 <img src="out5-1-1.png" width="256" height="256" 89 89 class="inline" alt="serpentine FS, 8 colours" /> 90 <img src="grad5-1-1.png" width="64" height="256" 91 class="inline" alt="serpentine FS, 8 colours gradient" /> 90 92 <img src="out5-1-2.png" width="256" height="256" 91 93 class="inline" alt="serpentine FS, 8 colours, gamma-corrected" /> 94 <img src="grad5-1-2.png" width="64" height="256" 95 class="inline" alt="serpentine FS, 8 colours, gamma-corrected gradient" /> 92 96 </p> 93 97 … … 144 148 <img src="out5-2-1.png" width="256" height="256" 145 149 class="inline" alt="Floyd-Steinberg, sum of absolute differences" /> 150 <img src="grad5-2-1.png" width="64" height="256" 151 class="inline" alt="Floyd-Steinberg, sum of absolute differences gradient" /> 146 152 <img src="out5-2-2.png" width="256" height="256" 147 153 class="inline" alt="Floyd-Steinberg, euclidian distance" /> 154 <img src="grad5-2-2.png" width="64" height="256" 155 class="inline" alt="Floyd-Steinberg, euclidian distance gradient" /> 148 156 </p> 149 157 … … 158 166 <img src="out5-2-3.png" width="256" height="256" 159 167 class="inline" alt="Floyd-Steinberg, 1×1 HSV cone" /> 168 <img src="grad5-2-3.png" width="64" height="256" 169 class="inline" alt="Floyd-Steinberg, 1×1 HSV cone gradient" /> 160 170 <img src="out5-2-4.png" width="256" height="256" 161 171 class="inline" alt="Floyd-Steinberg, 3×1 HSV cone" /> 172 <img src="grad5-2-4.png" width="64" height="256" 173 class="inline" alt="Floyd-Steinberg, 3×1 HSV cone gradient" /> 162 174 </p> 163 175 -
www/study/study.py
r2185 r2186 241 241 if chapter(0): 242 242 grad256bw = Image((32, 256)) 243 for x in range(32):244 for y in range(256):243 for y in range(256): 244 for x in range(32): 245 245 grad256bw.setGray(x, 255 - y, y / 255.) 246 246 grad256bw.save("gradient256bw.png") 247 247 else: 248 248 grad256bw = Image("gradient256bw.png") 249 250 # Create a 64x256 colour gradient 251 if chapter(0): 252 grad256 = Image((64, 256), True) 253 for y in range(255, -1, -1): 254 for x in range(64): 255 grad256.setRgb(x, y, x / 63., (255. - y) / 255, x / 63.) 256 grad256.save("gradient256.png") 257 else: 258 grad256 = Image("gradient256.png") 249 259 250 260 ############################################################################## … … 1253 1263 for (i, j, e) in err: 1254 1264 img[y + j][x + i] += error * e / total 1255 # 4. copy image, replacing gr ay with white1265 # 4. copy image, replacing grey with white 1256 1266 for y in range(h): 1257 1267 for x in range(w): … … 1911 1921 1912 1922 if chapter(5): 1923 test51x(grad256, ERROR_FSTEIN, test51y).save("grad5-1-1.png") 1913 1924 test51x(lenna256, ERROR_FSTEIN, test51y).save("out5-1-1.png") 1914 out512 = test51x(lenna256, ERROR_FSTEIN, test42x)1915 out512.save("out5-1-2.png")1925 test51x(grad256, ERROR_FSTEIN, test42x).save("grad5-1-2.png") 1926 test51x(lenna256, ERROR_FSTEIN, test42x).save("out5-1-2.png") 1916 1927 1917 1928 # Pattern 5.2.1: different colours give the same result … … 2075 2086 2076 2087 if chapter(5): 2088 test52x(grad256, ERROR_FSTEIN, 2089 ANSI_PALETTE, distmax, True).save("grad5-2-1.png") 2077 2090 test52x(lenna256, ERROR_FSTEIN, 2078 2091 ANSI_PALETTE, distmax, True).save("out5-2-1.png") 2092 test52x(grad256, ERROR_FSTEIN, 2093 ANSI_PALETTE, disteuclidian, True).save("grad5-2-2.png") 2079 2094 test52x(lenna256, ERROR_FSTEIN, 2080 2095 ANSI_PALETTE, disteuclidian, True).save("out5-2-2.png") … … 2083 2098 m = (float)(min(r, g, b)) 2084 2099 v = (float)(max(r, g, b)) 2085 if v == m :2100 if v == m or v == 0: 2086 2101 return 0., 0., v 2087 2102 s = (v - m) / v … … 2113 2128 2114 2129 if chapter(5): 2130 test52x(grad256, ERROR_FSTEIN, 2131 ANSI_PALETTE, disthsv, True).save("grad5-2-3.png") 2115 2132 test52x(lenna256, ERROR_FSTEIN, 2116 2133 ANSI_PALETTE, disthsv, True).save("out5-2-3.png") 2134 test52x(grad256, ERROR_FSTEIN, 2135 ANSI_PALETTE, disthsv3, True).save("grad5-2-4.png") 2117 2136 test52x(lenna256, ERROR_FSTEIN, 2118 2137 ANSI_PALETTE, disthsv3, True).save("out5-2-4.png")
Note: See TracChangeset
for help on using the changeset viewer.
