【问题标题】:Low pass filter processing image java低通滤波处理图像java
【发布时间】:2013-11-17 14:07:57
【问题描述】:

如何实现低通滤波器,我有:

BufferedImage img;
int width = img.getWidth();
int height = img.getHeight();

int L = (int) (f * Math.min(width, height));

for (int y = 0 ; y < height ; y++) {
    for (int x = 0 ; x < width ; x++) {
        if (x >= width / 2 - L && x <= width / 2 + L && y >= -L + height / 2 && y <= L + height / 2) {
            img.setRGB(x, y, 0);
        }
        else {}
    }
}

但首先我应该转换图像,但如何?

【问题讨论】:

    标签: java image-processing filter fft


    【解决方案1】:

    您编写的代码只会将图像边缘附近的像素设置为黑色。如果您在频域中这样做,您将拥有一个低通滤波器,因为图像边缘附近的像素将是高频分量,因此将它们设置为 0 将只留下低频分量。要在频域中操作,您需要应用傅立叶变换。但是,您需要注意低频分量在变换图像中的最终位置,因为傅里叶变换的不同实现可能会将低频分量置于变换图像的中心或角落之一。

    【讨论】:

      猜你喜欢
      • 2021-06-25
      • 1970-01-01
      • 2017-03-11
      • 2016-02-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多