拜耳有序抖动 [英] Bayer Ordered Dithering

查看:590
本文介绍了拜耳有序抖动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我更新插件Paint.net我在几个月前提出,这就是所谓的模拟色彩深度和它减少了图像的选择BPP中的颜色数量,很长一段时间它有抖动包括在内,但NEVER有序抖动,我认为这将是一个不错的除了有在,所以我就开始在网上的东西有用的搜索,我结束了这个Wiki页面这里的 http://en.wikipedia.org/wiki/Ordered_dithering ,并做书面的伪代码

I'm updating a plugin for Paint.net which i made some months ago, it's called Simulate Color Depth and it reduces the number of colors in the image to the chosen BPP and for a long time it have had dithering included but NEVER ordered dithering and i thought it would be a nice addition to have that in so i started to search on the internet for something useful, i ended up on this wiki page here http://en.wikipedia.org/wiki/Ordered_dithering, and tried to do as written in the pseudo code

for (int y = 0; x < image.Height; y++)
{  
    for (int x = 0; x < image.Width; x++)
    {
        Color color = image.GetPixel(x, y);  
        color.R = color.R + bayer8x8[x % 8, y % 8];  
        color.G = color.G + bayer8x8[x % 8, y % 8];  
        color.B = color.B + bayer8x8[x % 8, y % 8];  
        image.SetPixel(x, y, GetClosestColor(color, bitdepth);  
    }  
}

但结果是太亮,所以我决定再次检查wiki页面,然后我看到有一个1/65的门槛地图这让我想到两个错误的权利扩散(是的,我知道,奇怪吧?)除以我从 bayer8x8获得的价值[X%8,Y%8] 65,然后用色乘以值渠道,但无论结果是混乱的,否则还是太亮(我记得),但像我已经看到了在其他地方,要么太亮,过高的对比度或太乱了,我还没有发现什么真正有用的搜索结果是什么通过互联网,所以任何人都知道我能得到这个Bayer抖动是否正常工作?

but the result is way too bright so i decided to check the wiki page again and then i see that there's a "1/65" to the right of the threshold map which got me thinking of both error diffusing (yes i know, weird huh?) and dividing the value i get from bayer8x8[x % 8, y % 8] with 65 and then multiply the value with the color channels, but either the results were messy or else still too bright (as i remember it) but the results were nothing like i have seen elsewhere, either too bright, too high contrast or too messy and i haven't found anything really useful searching through the internet, so do anyone know how i can get this bayer dithering working properly?

谢谢,饼干

推荐答案

我不认为有什么不对原来的算法(维基百科)。亮度差异可能是显示器伽玛的神器。检查乔尔Yliluoma的阵地抖动算法,有关伽玛校正附录从这篇文章有关乔尔Yliluoma( HTTP发明了一种抖动算法:// bisqwit.iki.fi/story/howto/dither/jy/#Appendix%201GammaCorrection )看到效果的解释(注:网页是相当图形重型)

I don't think there's anything wrong with your original algorithm (from Wikipedia). The brightness disparity is probably an artifact of monitor gamma. Check Joel Yliluoma's Positional Dithering Algorithm, the appendix about gamma correction from this article about a dithering algorithm invented by Joel Yliluoma (http://bisqwit.iki.fi/story/howto/dither/jy/#Appendix%201GammaCorrection) to see an explanation of the effect (NB: page is quite graphics-heavy).

顺便说一句,也许是(显然是公共领域)的文章中详细的算法可以解决你的问题...

Incidentally, perhaps the (apparently public-domain) algorithm detailed in that article may be the solution to your problem...

这篇关于拜耳有序抖动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆