dither - Dithering of a GrayScale matrix
Several mehtods of dithering are supported. Ordered Dithering methos are Bayer-1 (method='b1'), Bayer-2 (method='b2'), Bayer-3 (method='b3'), Stucki-1 (method='s1'), Stucki-2 (method='s2'). There is an additional ordered dithering method, which is based upon a randon matrix (method='rd').
When the 2nd rhs argument is choosen as method='rand', then random dithering is done (Default).
k=1:1:256; [X,Y]=ndgrid(k,k); Z=ceil(0.5 .*(X+Y)); // Generate a picture f=gcf(); f.color_map=graycolormap(256); Matplot(Z); xclick(); xbasc(); zd=dither(Z,'s1'); // Do the dithering f.color_map=graycolormap(2); Matplot(full(zd)+1); // Show the dithered picture