问题
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