2017-04-04 64 views
0

我正在嘗試xy圖像中的斑點座標。Node.js在使用連接組件的圖像上找到blob

從這個問題的以下建議:Connected-component labeling with ImageMagick

我有這樣的一段代碼。

最終結果正確地突出顯示了斑點。

但是,我無法以編程方式獲得「詳細」輸出。我需要xy座標。 AM我錯過了什麼?

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` 
+0

對不起輸出的方式,我不能把握的Javascript所有,但也許你可以'重生()'是這樣的 - HTTP ://stackoverflow.com/a/15516475/2836621 –

+0

欣賞你的幫助。我找到了獲得blob職位詳細輸出的方式......張貼我的回答... – mkto

回答

1

我發現來從通用操作

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

做得好,並感謝您與SO社區分享您的發現。 –