【问题标题】:get percentage of image blur获取图像模糊百分比
【发布时间】:2012-12-12 13:16:39
【问题描述】:

您好,所以我必须编写一个脚本(不管是什么编程语言,但我将在这里使用 Java 为例),一个比较两张黑白图像并判断哪一张最模糊的脚本。

所以我必须做一个这样的函数:

function int getImageBlurPercentage()
{
    ArrayList<Integer> ColorList = new ArrayList<Integer>();

    //Part 1: fill ColorList with color values (0=black, 255=white)

    go through Y axis
        go through X axis
            ColorList -> add colorValue of each pixel; [ie: 0 to 255]


    //Part 2: process (This is the part where I need help !)

    int lastColor = 0;

    for(int color : ColorList)
    {
        // Something has to be done here
        // To compare pixel by pixel
        // and get noise result or difference result
        // and convert it to a percentage (0% - 100%)
        // This is where I need your help !
    }
}

所以这就是我需要你们帮助的地方,我真的不知道如何处理这个问题。 我认为这需要一些我不擅长的数学公式。

如果有人帮助或提供可以引导我走向正确道路的提示,我将不胜感激。谢谢。

【问题讨论】:

  • FFT 并比较最高频率?如果模糊后没有添加任何噪点,这将起作用。
  • FFT 并比较所有频率(加权)?这应该是可靠的。
  • @JanDvorak 我不知道这是什么意思,你能举个例子吗?
  • FFT = 快速傅里叶变换。傅里叶变换将数据从空间域变换到频域。
  • 然后整合渐变量:foreach x,y sum += (2 * p[x][y] - p[x-1][y] - p[x][y-1])。这很简单。

标签: java image-processing colors percentage


【解决方案1】:

当您对图像进行模糊处理(假设您使用高斯模糊)时,实际上是对图像的像素进行了一些“平均化”,这意味着您可以使边缘“更平滑”。

因此,要检查一张图像是否比其他图像具有“更平滑”的边缘,您可以像 Jan Dvorak 建议的那样查看图像的渐变,但不要忘记通过图像中的像素数量对其进行归一化(否则更大图像会得到更大的结果)。

如果要检查两个完全不同的图像,测试会复杂得多,因为不同的场景自然有不同的平滑度

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-11-28
    • 2012-01-02
    • 1970-01-01
    • 2011-12-14
    • 1970-01-01
    • 2020-11-29
    • 1970-01-01
    相关资源
    最近更新 更多