首先,我找到了本指南,其中详细介绍了我所需要的内容。
https://imagemagick.org/script/connected-components.php
在我的一生中,我无法让它发挥作用。大家有什么想法吗?
我已经尝试了指南中列出的脚本的多种变体。
此外,当我运行convert/var/www/mailtovoice/audrey/sean_look_grey.png -defineconnected-components:verbose=true -connected-components 8/var/www/mailtovoice/audrey/sean_look4.png
我得到了 1000 个对象。当我将其转换为仅包含 3 个对象的图像时,我得到了 100 秒。
最佳答案
Mark 的想法是正确的,但解决方案比他发布的要简单得多,因为 ImageMagick -connected-components 可以直接进行过滤和输出。
Unix 行结尾(对于 Windows 使用 ^
而不是 \
)
convert image.png \
-define connected-components:area-threshold=100 \
-define connected-components:mean-color=true \
-connected-components 4 \
result.png
关于linux - 脚本不工作。我究竟做错了什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52938385/