2017-10-28 23 views

回答

0

這將有助於獲得更多信息,但我假設您使用Coyote IDL庫中的blob_analyzer

所以,你從你的形象做一個Blob對象:

blobs = obj_new('blob_analyzer', image)

你可以找出使用NumberOfBlobs方法很多斑點是如何確定的:

n_blobs = blobs -> NumberOfBlobs()

另外,您可以使用ReportStats方法獲得有關所有斑點的摘要信息:

blobs -> ReportStats

要獲得第i個斑點指數,使用GetIndices方法:

indices = blobs -> GetIndices(i)

這應該給你指數的一維向量,它可以轉換爲使用ARRAY_INDICES 2D指數, 如果你想。這將是:

indices_2D = array_indices(image, indices)

爲了掩蓋斑點的形象,你可以簡單地做:

new_image = image ;Make a copy of the original image 
new_image[indices] = 0 ;Set all the pixels in the blob to 0 

這將,當然,只是掩蓋像素在第i個斑點,但是你可以簡單地做一個循環來重複上述過程來處理所有的斑點。

new_image = image ;Make a copy of the original image 
;Loop through and mask blobs 
for i = 0, n_blobs - 1 do begin 

    indices = blobs -> GetIndices(i) ;Get indices for the ith blob 
    new_image[indices] = 0   ;Mask those pixels 

endfor