使用同步滤波器对图像进行抗锯齿的算法
我一直在阅读有关抗锯齿的方法,并且由于它不是实时处理的,因此信号处理的抗锯齿似乎是理想的选择,特别是针对伪影。
然而,我读到的内容并没有提到将位图图像转换为信号并再次返回的步骤,因此我正在寻找一种算法或代码示例来证明这一点。
I have been reading about ways to do antialiasing and since its not processed in real time the antialising with signal processing seems to be ideal especial against artifacts.
However what I have read does not mention the step from turning a a bitmap image into a signal and back again,so I'm looking for an algorithm or code examples to demonstrate that.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
位图图像已经是一个数字信号 - 它是二维的,像素值是样本。您可以直接对其应用 sinc 滤波器。
A bitmap image already is a digital signal - it's 2 dimensional and the pixel values are the samples. You can apply a sinc filter to it directly.
通常的处理方式是在 x 和 y 方向上独立应用过滤器。这样,您的整体过滤器就是
g(x,y) = f(x) * f(y)
。在这种情况下,
g(x,y)
被称为可分离滤波器,其优点是,通过分别应用 x 和 y 滤波器,简单的滤波器卷积需要 O(XYF) 时间,其中 X 和 Y 是图像的尺寸,F 是滤波器f()
的支持宽度。相同大小的任意不可分离过滤器(将有 O(F^2) 个样本)通常需要 O(XYF^2) 时间......如果你真的想应用完整的 sinc() (
== sin(x)/x
) 过滤到您的图像,sinc() 函数的无限支持将使直接卷积变得非常慢。在这种情况下,对图像进行 2D FFT、在频域中进行滤波然后将其变换回来会更快。但在实践中,大多数人使用加窗或其他修改来获得可实际应用于空间域的有限滤波器。
The usual way things are handled are to apply your filter independently in both the x and y directions. That way, your overall filter is
g(x,y) = f(x) * f(y)
.In this kind of situation,
g(x,y)
is called a separable filter, and the advantage is that, by applying the x- and y- filters separately, a straightforward filter convolution takes O(X Y F) time, where X and Y are the dimensions of the image, and F is the support width of the filterf()
. An arbitrary nonseparable filter of the same size (which would have O(F^2) samples) generally requires O(X Y F^2) time...If you really want to apply an full sinc() (
== sin(x)/x
) filter to your image, the unlimited support of the sinc() function will make straightforward convolution very slow. In that case, it would be faster to do a 2D FFT of your image, filter in the frequency domain, and transform it back.In practice, though, most people use windowing or other modification, to get a finite filter that can be practically applied in the spatial domain.