0

I have a binary 2D np array containing information in the following (example) figure. How can I detect the cluster of data points (here black in color) so that I can remove the cluster of points from the array one by one? Here, think of it as controlling and accordingly removing the circles from the image as per the user's task need.

Task: Detection and removal of any one of the n-cluster of data points from a numpy array

Any leads would be appreciated. [Image for reference]

enter image description here

Manav Mishra
  • 103
  • 1
  • 6
  • Do you require the clusters to be removed in a specific order? also, will each cluster be completely spherical and of the same radius? – rab1262 Dec 18 '21 at 09:18
  • There is no such ordering sequence as such to remove the cluster. The cluster shape may not always be spherical and may vary in radius as well. Looking for a generic method to detect the clusters. – Manav Mishra Dec 18 '21 at 09:26
  • I would recommend using opencv, the blob detection functionality sounds most suitable for this: https://learnopencv.com/blob-detection-using-opencv-python-c/ – rab1262 Dec 18 '21 at 09:30

1 Answers1

1

opencv is indeed a good choice. However, instead of blob detection, I would suggest to find "connected components" which gives you some more flexibility. This answer should lead you into the right direction: connected component labeling in python

BanDoP
  • 79
  • 5