Node.js find blob on image using connected components

不羁的心 提交于 2019-12-13 07:04:57

问题


I am trying to x y coordinates of blobs in an image.

Following suggestions from this question:Connected-component labeling with ImageMagick

I have this piece of code.

The end result correctly highlights the blobs.

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`

回答1:


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
});


来源:https://stackoverflow.com/questions/43209499/node-js-find-blob-on-image-using-connected-components

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!