前言

最近一直在做墨水屏小摆件,想要显示图片。奈何墨水屏只有黑白二色(HINK-E029A01)。

记得之前看过甘草酸不酸的墨水屏阅读器,使用抖动算法实现了16色灰阶。于是乎,想学习下弗洛伊德抖动算法。

参考资料

Floyd–Steinberg dithering - Wikipedia

像素抖动例程 · 甘草酸不酸/天气墨水屏 - 码云 - 开源中国 (gitee.com)

简介

Floyd–Steinberg dithering is an image dithering algorithm first published in 1976 by Robert W. Floyd and Louis Steinberg. It is commonly used by image manipulation software, for example when an image is converted into GIF format that is restricted to a maximum of 256 colors.

Floyd-Steinberg抖动是一种图像抖动算法,由Robert W. Floyd和Louis Steinberg于1976年首次发表。它通常被图像处理软件使用,例如当将图像转换为最多256种颜色的GIF格式时。

The algorithm achieves dithering using error diffusion, meaning it pushes (adds) the residual quantization error of a pixel onto its neighboring pixels, to be dealt with later. It spreads the debt out according to the distribution (shown as a map of the neighboring pixels).

该算法通过误差扩散实现抖动效果,即将像素的剩余量化误差推送(添加)到其相邻像素上,以便稍后处理。它根据分布情况(显示为相邻像素的地图)来分散这个债务。

我的理解是:Floyd–Steinberg算法并不会增加颜色的种类,而是借助于色点让人眼误以为自己看到了更多种颜色。