Simple Multi-Blob Detection of a Binary Image?
Asked Answered
P

3

5

If there is a given 2d array of an image, where threshold has been done and now is in binary information.

Is there any particular way to process this image to that I get multiple blob's coordinates on the image?

I can't use openCV because this process needs to run simultaneously on 10+ simulated robots on a custom simulator in C.

I need the blobs xy coordinates, but first I need to find those multiple blobs first.

Simplest criteria of pixel group size should be enough. But I don't have any clue how to start the coding.

PS: Single blob should be no problem. Problem is multiple blobs.

Just a head start ?

Parley answered 21/4, 2013 at 14:41 Comment(2)
Try google-ing for connected components. You can also look up blob detection based on the Laplacian of Gaussian operator.Splanchnology
Well, laplacian of Gaussion operator, I don't understand how to implement it in code....Parley
A
5

Have a look at QuickBlob which is a small, standalone C library that sounds perfectly suited for your needs.

QuickBlob comes with a small command-line tool (csv-blobs) that outputs the position and size of each blob found within the input image:

./csv-blobs white image.png
X,Y,size,color
28.37,10.90,41,white
51.64,10.36,42,white
...

Here's an example (output image is produced thanks to the show-blobs.py tiny Python utility that comes with QuickBlob):

input image output image

Autumnautumnal answered 22/4, 2013 at 8:59 Comment(0)
W
1

You can go through the binary image labeling the connected parts with an algorithm like the following:

  1. Create a 2D array of ints, labelArray, that will hold the labels of the connected regions and initiate it to all zeros.

  2. Iterate over each binary pixel, p, row by row

    A. If p is true and the corresponding value for this position in the labelArray is 0 (unlabeled), assign it to a new label and do a breadth-first search that will add all surrounding binary pixels that are also true to that same label.

The only issue now is if you have multiple blobs that are touching each other. Because you know the size of the blobs, you should be able to figure out how many blobs are in a given connected region. This is the tricky part. You can try doing a k-means clustering at this point. You can also try other methods like using binary dilation.

Wiry answered 21/4, 2013 at 15:7 Comment(0)
M
1

I know that I am very late to the party, but I am just adding this for the benefipeople who are researching this problem.

Here is a nice description that might fit your needs. http://www.mcs.csueastbay.edu/~grewe/CS6825/Mat/BinaryImageProcessing/BlobDetection.htm

Mcniel answered 19/11, 2015 at 14:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.