小编Mar*_*saw的帖子

这是有序抖动的正确实现吗?

我对抖动感兴趣,命令抖动更精确。我花了很多时间在研究和实验上。并希望经过所有努力,我的代码能够正常工作。

我将提供执行抖动的代码和一些示例。

我的问题

  • 它是如何工作的?
  • 我的代码正确吗?
  • 可以有任何简化吗?

这是这篇维基百科文章中抖动算法的伪代码,我的代码基于文章。

伪代码

以下是变量解释:

M(i, j)是第i行第jc上的阈值图是变换后的颜色,r是颜色空间中的扩散量。假设一个 RGB 调色板具有均匀选择的颜色,其中每个颜色坐标由一个八位字节表示,通常会选择:在此处输入图片说明


现在,这是我的实现(伪代码):

ditherMatrix = 4x4; // By 4x4 I mean the normal 4x4 dither matrix from the wikipedia article
ditherMatrixSize = 4;
offset = (ditherMatrixSize * (ditherMatrixSize / 2) - 0.5); 
/* In the wiki article it uses 0.5 as an offset, 
   but I have to do this instead. 
   Is this correct? …
Run Code Online (Sandbox Code Playgroud)

c# image-processing dithering

5
推荐指数
1
解决办法
2315
查看次数

标签 统计

c# ×1

dithering ×1

image-processing ×1