Changeset 1937
- Timestamp:
- 11/11/07 22:16:15 (6 years ago)
- Location:
- www/study
- Files:
-
- 4 added
- 2 edited
-
fig3-2-4.png (added)
-
fig3-2-4.svg (added)
-
grad3-2-4.png (added)
-
index.html (modified) (2 diffs)
-
out3-2-4.png (added)
-
study.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
www/study/index.html
r1936 r1937 337 337 </p> 338 338 339 <p> Finally, <b>Stucki dithering</b> is a slight variation of340 Jarvis-Judice-Ninkedithering: </p>339 <p> <b>Stucki dithering</b> is a slight variation of Jarvis-Judice-Ninke 340 dithering: </p> 341 341 342 342 <p style="text-align: center;"> … … 347 347 <img src="grad3-2-3.png" width="32" height="256" 348 348 class="inline" alt="Stucki error diffusion gradient" /> 349 </p> 350 351 <p> <b>Burkes dithering</b> is yet another variation: </p> 352 353 <p style="text-align: center;"> 354 <img src="fig3-2-4.png" width="200" height="120" 355 style="margin-right: 30px;" alt="Burkes" /> 356 <img src="out3-2-4.png" width="256" height="256" 357 class="inline" alt="Burkes error diffusion" /> 358 <img src="grad3-2-4.png" width="32" height="256" 359 class="inline" alt="Burkes error diffusion gradient" /> 349 360 </p> 350 361 -
www/study/study.py
r1936 r1937 346 346 347 347 # Output 3-2-3: Stucki 348 # TODO: merge with Jarvis , Judice andNinke348 # TODO: merge with Jarvis-Judice-Ninke 349 349 def test323(src, name): 350 350 (w, h) = src.size() … … 379 379 test323(lenna256bw, "out3-2-3.png") 380 380 test323(gradient256bw, "grad3-2-3.png") 381 382 # Output 3-2-4: Burkes 383 # TODO: merge with Jarvis-Judice-Ninke and Stucki 384 def test324(src, name): 385 (w, h) = src.size() 386 dest = Image((w, h)) 387 ep = [0.] * (w + 4) 388 for y in range(h): 389 ey = [0.] * (w + 4) 390 ex = 0 391 ex2 = 0 392 for x in range(w): 393 c = src.getGray(x, y) + ex + ep[x + 2] 394 d = c > 0.5 395 dest.setGray(x, y, d) 396 error = c - d 397 ex = ex2 + error * 8. / 32. 398 ex2 = error * 4. / 32. 399 ey[x] += error * 2. / 32. 400 ey[x + 1] += error * 4. / 32. 401 ey[x + 2] += error * 8. / 32. 402 ey[x + 3] += error * 4. / 32. 403 ey[x + 4] += error * 2. / 32. 404 ep = ey 405 dest.writePng(name) 406 407 test324(lenna256bw, "out3-2-4.png") 408 test324(gradient256bw, "grad3-2-4.png") 381 409 382 410 ##############################################################################
Note: See TracChangeset
for help on using the changeset viewer.
