Simple Multi-Blob Detection of a Binary Image?

≯℡__Kan透↙ 提交于 2019-12-22 06:16:05

问题


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 ?


回答1:


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):




回答2:


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.




回答3:


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



来源:https://stackoverflow.com/questions/16132303/simple-multi-blob-detection-of-a-binary-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!