[comp.windows.x] 4x4 Dithering Patterns?

bzs@bu-cs.BU.EDU (Barry Shein) (05/30/89)

First, does anyone have a set of 4x4 dithering patterns for
pseudo-halftone? If so perhaps you could mail it to me (should be
fairly small, just an array of hexnums or some such, I'll figure
it out.)

Second, after having tried to create my own it strikes me that either
I am dense (ahem) or, in general, there's no obvious way to create
such patterns. In part one could chalk it all up to a matter of taste
(and application) but is there more guidance than I suspect?

For a 4x4 dither there are 32,768 possible patterns, that's too many
to just skim through with a tool. One can eliminate a lot of them with
some easy tests (eg. anything stripey is not a candidate, such as
0xf0f0). Then I guess you could sort them roughly by the percentage of
bits set, the intensities will more or less fall along those lines.

Beyond that I have no idea for an algorithmic way to choose even
high-probability dithers (eg. narrow down to a few choices in a range
and then just look at a tiling of them.)

Is there more order than I describe here? Perhaps I should have gone
to the library first and sorted through papers but perhaps someone on
this list will point me towards some and save me some time.
-- 
	-Barry Shein

Software Tool & Die, Purveyors to the Trade
1330 Beacon Street, Brookline, MA 02146, (617) 739-0202

jbm@eos.UUCP (Jeffrey Mulligan) (05/31/89)

From article <31971@bu-cs.BU.EDU>, by bzs@bu-cs.BU.EDU (Barry Shein):
 
> Is there more order than I describe here? Perhaps I should have gone
> to the library first and sorted through papers

You said it, not me

> but perhaps someone on
> this list will point me towards some and save me some time.
> -- 
> 	-Barry Shein

Algorithms for generating the arrays are described in Ulichney's
recent book (Digital Halftoning) which is often cited on this newsgroup.
The seminal reference seems to be

	Bayer, B.E. (1973)  "An optimum method for two level rendition
	of continuous tone pictures", Proc. IEEE Int. Conf. Commun.
	Conference Record, pp. (26-11)-(26-15).

A simple way to do this without going to the library is to start with
a small pattern:

	0 2
	3 1

And double it in size by multiplying the original by four, repicating,
and adding the elements of the original to each block:

	times 4	            0  8
			    12 4

	replicate           0  8 0  8
			    12 4 12 4
			    0  8 0  8
			    12 4 12 4

			       +

			    0 0 2 2
			    0 0 2 2
			    3 3 1 1
			    3 3 1 1

			       =

			    0  8  2  10
			    12 4  14 6
			    3  11 1  9
			    15 7  13 5


Gee, I meant to leave some of the work for you.

Happy dithering.

-- 

	Jeff Mulligan (jbm@aurora.arc.nasa.gov)
	NASA/Ames Research Ctr., Mail Stop 239-3, Moffet Field CA, 94035
	(415) 694-6290