# Changeset 2002Tweet

Ignore:
Timestamp:
Nov 17, 2007, 3:12:54 AM (14 years ago)
Message:
• Started section 5.2 (accounting for other dimensions).
Location:
www/study
Files:
3 edited

Unmodified
Removed
• ## www/study/part5.html

 r1979 depends on the output media even more than grayscale dithering.

Separate-space dithering

5.1. Separate-space dithering

In some cases it is possible to perform three one-dimensional dithering

5.2. Accounting for other dimensions

The following patterns shows three ways to dither the same colour using our 8-colour palette. The first one mixes black, yellow and white pixels. The second one mixes red, green and cyan pixels. The last one mixes red, green and magenta pixels. But they all visually blend to the same colour:

• ## www/study/study.py

 r1991 test501(lenna256, ERROR_FSTEIN, test42x).writePng("out5-1-2.png") # Pattern 5.1.2: red-green or red-yellow pattern? # Pattern 5.1.2: different colours give the same result dest = Image((240, 160)) for x in range(80): for y in range(80): r = DITHER_BAYER44[(y / 4) % 4][(x / 4) % 4] > 11 r = DITHER_BAYER44[(y / 4) % 4][(x / 4) % 4] > 7 g = DITHER_BAYER44[(y / 4) % 4][(x / 4) % 4] > 13 dest.setRgb(x, y, r, 0, g) b = DITHER_BAYER44[(y / 4) % 4][(x / 4) % 4] > 7 dest.setRgb(x, y, r, b, g) for y in range(80, 160): r = DITHER_BAYER44[y % 4][x % 4] > 11 r = DITHER_BAYER44[y % 4][x % 4] > 7 g = DITHER_BAYER44[y % 4][x % 4] > 13 dest.setRgb(x, y, r, 0, g) b = DITHER_BAYER44[y % 4][x % 4] > 7 dest.setRgb(x, y, r, b, g) for x in range(80, 160): for y in range(80): r = DITHER_BAYER44[(y / 4 + 1) % 4][(x / 4 + 1) % 4] > 11 r = DITHER_BAYER44[(y / 4) % 4][(x / 4 + 1) % 4] > 7 g = DITHER_BAYER44[(y / 4) % 4][(x / 4) % 4] > 13 dest.setRgb(x, y, r, 0, g) b = DITHER_BAYER44[(y / 4) % 4][(x / 4) % 4] > 7 dest.setRgb(x, y, r, b, g) for y in range(80, 160): r = DITHER_BAYER44[(y + 1) % 4][(x + 1) % 4] > 11 r = DITHER_BAYER44[y % 4][(x + 1) % 4] > 7 g = DITHER_BAYER44[y % 4][x % 4] > 13 dest.setRgb(x, y, r, 0, g) b = DITHER_BAYER44[y % 4][x % 4] > 7 dest.setRgb(x, y, r, b, g) for x in range(160, 240): for y in range(80): r = DITHER_BAYER44[(y / 4) % 4][(x / 4 + 1) % 4] > 11 r = DITHER_BAYER44[(y / 4 + 1) % 4][(x / 4 + 1) % 4] > 7 g = DITHER_BAYER44[(y / 4) % 4][(x / 4) % 4] > 13 dest.setRgb(x, y, r, 0, g) b = DITHER_BAYER44[(y / 4 + 1) % 4][(x / 4) % 4] > 7 dest.setRgb(x, y, r, b, g) for y in range(80, 160): r = DITHER_BAYER44[y % 4][(x + 1) % 4] > 11 r = DITHER_BAYER44[(y + 1) % 4][(x + 1) % 4] > 7 g = DITHER_BAYER44[y % 4][x % 4] > 13 dest.setRgb(x, y, r, 0, g) b = DITHER_BAYER44[(y + 1) % 4][x % 4] > 7 dest.setRgb(x, y, r, b, g) dest.writePng("pat5-1-2.png")
Note: See TracChangeset for help on using the changeset viewer.