0

I need to find blobs indices and then mask them at the continuum image. Who can help me? please let me know how can I list the indices of blobs. I use blob_analyzer to analyze the images. Cheers Mahtab

Dmitry
  • 6,716
  • 14
  • 37
  • 39
mgh
  • 1
  • 2

1 Answers1

0

It would be helpful to have more information, but I'm assuming you are using blob_analyzer from the Coyote IDL Library.

So, you make a blob object from your image:

blobs = obj_new('blob_analyzer', image)

You can find out how many blobs were identified using the NumberOfBlobs method:

n_blobs = blobs -> NumberOfBlobs()

Alternatively, you can get summary information about all the blobs using the ReportStats method:

blobs -> ReportStats

To get the indices for the ith blob, use the GetIndices method:

indices = blobs -> GetIndices(i)

This should give you a 1D vector of indices, which you can convert to 2D indices using ARRAY_INDICES, if you want. That would be:

indices_2D = array_indices(image, indices)

To mask the blobs in the image, you can simply do:

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

That will, of course, only mask the pixels in the ith blob, but you could simply make a loop to repeat the above process for all the blobs.

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
Steve G
  • 182
  • 9