[comp.graphics] wanted: 16x16 or larger dither matrix

serge@ucbvax (serge) (01/23/87)

[]
	My apologies if you're seeing this more than once.  The original
posting seems not to have made it.

	Does anyone have a 16x16 or larger dither matrix, or know how to
generate one from a 8x8 dither matrix (the largest in "Fundamentals of
Interactive Computer Graphics" by Foley and Van Dam)?  Thank you very much.

						Serge
						serge@ucbvax.berkeley.edu
						...!ucbvax!serge

P.S.	I am converting a color image to a black and white one.  If you
	know of a better algorighm than dithering, I would appreciate
	hearing about it also.

bayes@hpfcrj.UUCP (02/06/87)

Re generating 16x16 dither matrix from 8x8:

One method is to replicate the 8x8 4 times into a 16x16 array, after
multiplying the original by 4. Viz:

	+---+---+
	|x4 |x4 |
	+---+---+
	|x4 |x4 |
	+---+---+

Now add 0 to each value in the upper left quadrant, 1 to each in lower right,
3 to each in upper right, and 2 to each in lower left. You can swap the 
values to add diagonally, but not along a row or column.

An example of expanding 2x2 to 4x4 follows.

The original:

	0    3

	2    1

Replicate, multiplying by 4:

	0   12     0  12
	8    4     8   4

	0   12     0  12
	8    4     8   4

Add:

	0   12     3  15
	8    4    11   7

	2   14     1  13
	10   6     9   5

This process is completely recursive, and you can start at a 1x1 dither
matrix [0], and work up to any 2^n x 2^n. I don't know a non-recursive
formula for any n, but am sure it's not hard to figure out.

Scott Bayes
hpfcla!bayes

This algorithm was independently arrived at by me, and I am not
representing Hewlett-Packard or any company in this note.