dither - Dithering of a GrayScale matrix
Calling Sequence: y = dither(x,method)
Parameters
x : Matrix with elements with range of values [1...256], representing e. g. a
grayscale image.
method : string with 2 characters, determing the method of dithering
y : dithered binary picture, matrix with elements with range of value {0,1}.
Description
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).
Example:
---------
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