perl - ImageMagick:寻找一种快速模糊图像的方法

标签 perl image-processing imagemagick gaussian gaussianblur

我正在寻找一种比使用GaussianBlur更快的模糊图像的方法
我正在寻找的解决方案可以是命令行解决方案,但我更喜欢使用 perl 表示法的代码。

实际上,我们使用 Perl image magick API 来模糊图像:

# $image is our Perl object holding a imagemagick perl image
# level is a natural number between 1 and 10
$image->GaussianBlur('x' . $level);

这工作得很好,但随着关卡高度的增加,它消耗的时间似乎呈指数级增长。

问题:如何缩短模糊操作所用的时间? 还有另一种更快的方法来模糊图像吗?

最佳答案

我发现the suggested method调整图像大小以进行模糊模仿会使输出看起来非常像素化,因为西格玛值非常大,例如 25 或更大。所以我最终想到了缩小-模糊-放大的想法,这产生了非常好的结果(几乎与大西格玛的简单模糊没有区别):

# plain slow blur
convert -blur 0x25 sample.jpg blurred_slow.jpg
# much faster
convert -scale 10% -blur 0x2.5 -resize 1000% sample.jpg blurred_fast.jpg

在我的 i5 2.7Ghz 上,速度提升高达 10 倍。

关于perl - ImageMagick:寻找一种快速模糊图像的方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35649413/

相关文章:

python - 如何在 Python 中使用 imagemagick?

image - 使用ImageMagick调整尺寸,使其具有最大的宽度/高度

perl - 从 Ant 执行 Perl 脚本的最跨平台的方式是什么?

perl - 将整数转换为 8 字节长

perl - 在 Matlab 中实时显示 Perl 脚本的输出

perl - 如何判断gzip文件是否为空压缩文件

c++ - 如何在openCV中获取像素矩阵和 reshape 矩阵

image-processing - 从直方图中检测两个最高峰

python - 如何去除图像 OpenCV、Python 中的噪声?

Imagemagick 去除水印