how to group clusters?
Using python and opencv most recent versions.
I have an image like this one:
When the red dots appear, their position always random, so I don't know where they will be next time, this is just as an example. However there are 3 facts:
- I will have the x, y coordinates of each dot
- There will always be at least 3 clustered dots and the rest spread out elsewhere.
- There will always be only one cluster. It is possible that another 2 dots are closed together, but only 3 close dots will be considered clusters.
I want to detect where the cluster is and draw a shape around them. The expected output should be like this:
Since I don't know where they will appear, if I use a red dot as a reference to measure distance, it is possible that one will be outside the cluster. If I try to determine if the dot is in the cluster measuring their x position, it is possible the next cluster will be further away and the spread out dots will be closer on the x side.
I have thought about measuring the distance of each dot against all others and set a threshold of a determined amount of pixels. After that, somehow draw the shape, but I just have no idea of how to do this.
The dots don't really contain any information besides their location (x,y).
Any ideas on how to solve this would be appreciated.
Hi, I have faced same problem of group clusters so please answer its with nice wording thanks