【发布时间】:2018-09-11 06:04:18
【问题描述】:
我正在尝试计算图像中对象的数量
使用 php 魔术函数后,我可以将其转换为二进制图像
我需要的是一个函数,在这种情况下返回图像中白色物体的数量 8 我对图像了解不多,但是在 imagemagic 上有一个已删除的帖子,其中使用以下命令
var_dump(
exec("convert out.pbm -define connected-components:verbose=true -define connected-components:area-threshold=50 \ -connected-components 4 -auto-level -depth 8 test.png")
);
【问题讨论】:
-
我已经发布了 40 多个答案,请在 StackOverflow 搜索框中输入以下内容
user:2836621 connected components -
@MarkSetchell 我在看你的这篇文章,我认为这将是我的解决方案,但是 exec 函数没有返回任何内容,我厌倦了一个简单的转换命令,它正在工作
-
我厌倦了不同的命令块 exec("convert binary.jpg -colorspace gray -negate -threshold 10% -define connected-components:verbose=true -define connected-components:area-threshold=100 output.png", $o) 它的工作和 output.png 被创建(但是我在 php 中没有得到任何回报)但是当我添加最终命令时 -connected-components 8 -auto-level 输出文件没有创建所以这意味着有一些错误
标签: php imagemagick