Four shades of gray random dithering, four shade Floyd-Steinberg and
the original 256 shade image.
the original 256 shade image.
FS dithering with 2 bits per color (RGB have 4 different values) with
total of 64 different colors and original 16 777 216 color image.
M
=
4;
pixel
=
imread('david.png');
figure;
image(pixel);
colormap(gray(256));
truesize;
pixel
=
(M-1)*double(pixel)/255;
[Y
X] =
size(pixel);
for
y =
1+1:Y-1
for
x =
1+1:X-1
oldpixel
=
pixel(y, x);
newpixel
=
round(oldpixel);
pixel(y,
x) =
newpixel;
quant_error
=
oldpixel -
newpixel;
pixel(y,
x+1)
=
pixel(y, x+1)
+
quant_error*7/16;
pixel(y+1,
x-1)
=
pixel(y+1,
x-1)
+
quant_error*3/16;
pixel(y+1,
x) =
pixel(y+1,
x) +
quant_error*5/16;
pixel(y+1,
x+1)
=
pixel(y+1,
x+1)
+
quant_error*1/16;
end
end
figure;
image(uint8(255*pixel/(M-1)));
colormap(gray(256));
truesize;
What is the purpose of life?
...to explore and have fun forever?
No comments:
Post a Comment