Node.js使用连接的组件在图像上找到斑点 [英] Node.js find blob on image using connected components
本文介绍了Node.js使用连接的组件在图像上找到斑点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试x y图像中斑点的坐标.
I am trying to x y coordinates of blobs in an image.
以下问题的建议:使用ImageMagick进行连接组件的标签
我有这段代码.
最终结果正确突出了斑点.
The end result correctly highlights the blobs.
但是,我无法以编程方式获得详细"输出.我需要x y坐标.我错过了什么吗?
However, I am unable to get the "verbose" output programmatically. I need the x y coordinates. AM I missing something?
gm('difference.png')
.out('-colorspace')
.out('gray')
.out('-threshold')
.out('90%')
.out('-define')
.out('connected-components:verbose=true')
.out('-connected-components')
.out('4')
.out('-auto-level')
.write("out.png", function(err){
console.log(err);
//how to get the verbose output about the blob positions??
});`enter code here`
推荐答案
我找到了从gm操作获取输出的方法
I found the way to get the output from the gm operations
gm(imagePath)
.out('-define')
.out('connected-components:verbose=true')
.out('-connected-components')
.out('4')
.out('-auto-level')
.write('out.png', function(err, stdout){
//details in stdout
});
这篇关于Node.js使用连接的组件在图像上找到斑点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文