Html 如何在FabricJS中创建更强的模糊?

Html 如何在FabricJS中创建更强的模糊?,html,canvas,Html,Canvas,我正在使用FabricJS将图像上传到画布上,我想对其进行模糊处理。看看他们的例子,我可以创建一个光模糊。然而,我想让这个模糊更强烈。基本上,我想使这个更强大的模糊,然后有文字在上面。我想我需要调整卷积矩阵,但我不确定该怎么做 有什么提示吗 另外,我会上传一个提琴,但由于画布和CORS图像的问题,它不会有用:(我解决这个问题的方法是使过滤器更大、更密集(我不完全确定它是如何工作的,但它可以工作,未来仍在寻找ELI5) 框模糊输出卷积矩阵内像素值的平均值。方法是创建一个大小为NxN的卷积矩阵,其中

我正在使用FabricJS将图像上传到画布上,我想对其进行模糊处理。看看他们的例子,我可以创建一个光模糊。然而,我想让这个模糊更强烈。基本上,我想使这个更强大的模糊,然后有文字在上面。我想我需要调整卷积矩阵,但我不确定该怎么做

有什么提示吗


另外,我会上传一个提琴,但由于画布和CORS图像的问题,它不会有用:(

我解决这个问题的方法是使过滤器更大、更密集(我不完全确定它是如何工作的,但它可以工作,未来仍在寻找ELI5)

框模糊输出卷积矩阵内像素值的平均值。方法是创建一个大小为NxN的卷积矩阵,其中每个权重为1/(NxN)。这样,矩阵内的每个像素对输出图像的贡献相等,权重之和为1

矩阵

    // weak convolution filter box blur
    [ 1/9, 1/9, 1/9,
      1/9, 1/9, 1/9,
      1/9, 1/9, 1/9 ]
    // stronger convolution filter box blur
    [ 1/18, 1/18, 1/18,
      1/18, 1/18, 1/18,
      1/18, 1/18, 1/18,
      1/18, 1/18, 1/18,
      1/18, 1/18, 1/18,
      1/18, 1/18, 1/18 ]
    // strong convolution filter box blur
    [ 1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27 ]
    // super strong convolution filter box blur
    [ 1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36 ]
输出

矩阵

    // weak convolution filter box blur
    [ 1/9, 1/9, 1/9,
      1/9, 1/9, 1/9,
      1/9, 1/9, 1/9 ]
    // stronger convolution filter box blur
    [ 1/18, 1/18, 1/18,
      1/18, 1/18, 1/18,
      1/18, 1/18, 1/18,
      1/18, 1/18, 1/18,
      1/18, 1/18, 1/18,
      1/18, 1/18, 1/18 ]
    // strong convolution filter box blur
    [ 1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27 ]
    // super strong convolution filter box blur
    [ 1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36 ]
输出

矩阵

    // weak convolution filter box blur
    [ 1/9, 1/9, 1/9,
      1/9, 1/9, 1/9,
      1/9, 1/9, 1/9 ]
    // stronger convolution filter box blur
    [ 1/18, 1/18, 1/18,
      1/18, 1/18, 1/18,
      1/18, 1/18, 1/18,
      1/18, 1/18, 1/18,
      1/18, 1/18, 1/18,
      1/18, 1/18, 1/18 ]
    // strong convolution filter box blur
    [ 1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27 ]
    // super strong convolution filter box blur
    [ 1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36 ]
输出

矩阵

    // weak convolution filter box blur
    [ 1/9, 1/9, 1/9,
      1/9, 1/9, 1/9,
      1/9, 1/9, 1/9 ]
    // stronger convolution filter box blur
    [ 1/18, 1/18, 1/18,
      1/18, 1/18, 1/18,
      1/18, 1/18, 1/18,
      1/18, 1/18, 1/18,
      1/18, 1/18, 1/18,
      1/18, 1/18, 1/18 ]
    // strong convolution filter box blur
    [ 1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27 ]
    // super strong convolution filter box blur
    [ 1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36 ]
输出


我解决这个问题的方法是使过滤器更大、更密集(我不完全确定它是如何工作的,但它确实起到了作用,未来仍在寻找ELI5)

框模糊输出卷积矩阵内像素值的平均值。方法是创建一个大小为NxN的卷积矩阵,其中每个权重为1/(NxN)。这样,矩阵内的每个像素对输出图像的贡献相等,权重之和为1

矩阵

    // weak convolution filter box blur
    [ 1/9, 1/9, 1/9,
      1/9, 1/9, 1/9,
      1/9, 1/9, 1/9 ]
    // stronger convolution filter box blur
    [ 1/18, 1/18, 1/18,
      1/18, 1/18, 1/18,
      1/18, 1/18, 1/18,
      1/18, 1/18, 1/18,
      1/18, 1/18, 1/18,
      1/18, 1/18, 1/18 ]
    // strong convolution filter box blur
    [ 1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27 ]
    // super strong convolution filter box blur
    [ 1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36 ]
输出

矩阵

    // weak convolution filter box blur
    [ 1/9, 1/9, 1/9,
      1/9, 1/9, 1/9,
      1/9, 1/9, 1/9 ]
    // stronger convolution filter box blur
    [ 1/18, 1/18, 1/18,
      1/18, 1/18, 1/18,
      1/18, 1/18, 1/18,
      1/18, 1/18, 1/18,
      1/18, 1/18, 1/18,
      1/18, 1/18, 1/18 ]
    // strong convolution filter box blur
    [ 1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27 ]
    // super strong convolution filter box blur
    [ 1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36 ]
输出

矩阵

    // weak convolution filter box blur
    [ 1/9, 1/9, 1/9,
      1/9, 1/9, 1/9,
      1/9, 1/9, 1/9 ]
    // stronger convolution filter box blur
    [ 1/18, 1/18, 1/18,
      1/18, 1/18, 1/18,
      1/18, 1/18, 1/18,
      1/18, 1/18, 1/18,
      1/18, 1/18, 1/18,
      1/18, 1/18, 1/18 ]
    // strong convolution filter box blur
    [ 1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27 ]
    // super strong convolution filter box blur
    [ 1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36 ]
输出

矩阵

    // weak convolution filter box blur
    [ 1/9, 1/9, 1/9,
      1/9, 1/9, 1/9,
      1/9, 1/9, 1/9 ]
    // stronger convolution filter box blur
    [ 1/18, 1/18, 1/18,
      1/18, 1/18, 1/18,
      1/18, 1/18, 1/18,
      1/18, 1/18, 1/18,
      1/18, 1/18, 1/18,
      1/18, 1/18, 1/18 ]
    // strong convolution filter box blur
    [ 1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27,
      1/27, 1/27, 1/27 ]
    // super strong convolution filter box blur
    [ 1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36,
      1/36, 1/36, 1/36 ]
输出


看看我的要点:


相同的修复现在应用于要点。

在这里查看我的要点:


相同的修复现在应用于要点。

可能多次应用模糊以创建更强的模糊?好主意,但问题是它需要很长时间:(.我尝试过:p可能多次应用模糊以创建更强的模糊?好主意,但问题是它需要很长时间:(.我试过了:p这太棒了,兄弟..比你灵感来源的代码更好。谢谢你这太棒了,兄弟..比你灵感来源的代码更好。谢谢