Effacer les filtres
Effacer les filtres

segregate various elements of a matrix into separate groups based on their close proximity

4 vues (au cours des 30 derniers jours)
Hello, I have a 2D matrix that I have created from filtering a contour map of an image and I created a regional maxima of the final image as shown in the attached photo. now the matrix contains only ones and zeros in a random order. I need now to group all the points with "ones" that are in close proximity into a single group and know the raw and column matrix indexes of the first element of each group. this to be applied to all groups. I do not want to do this manually, as I want to apply this algortihm to thousands of matrices that have their regional maxima distributed randomly. I need to know if there is a certain function/exchange file in matlab that can manage to segregate these groups. please find attached photo for more explanation of what I need. Thanks in advance.

Réponse acceptée

Image Analyst
Image Analyst le 9 Fév 2018
Do you know how many groups there will be? If so, just get the x and y coordinates of each point using find(), then pass them into kmeans().
If you don't know then you could use some other clustering technique, like dbscan.
Or you could use pdist2() and cluster that by thresholding. It would be simple but it would probably require that the groups be well separated (unlike dbscan).
There are other unsupervised clustering methods that you can use. Take a deeper dive here: https://www.mathworks.com/help/stats/cluster-analysis.html
  1 commentaire
Hossam Selim
Hossam Selim le 9 Fév 2018
Thanks a lot for your kind answer. I believe dbscan is the best solution I can use in this case. It is really useful for my requirements. Thanks a lot for your kind help. appreciated. ... Just for general notes, Basically I do not know how many groups they are, but I would only consider the first 5 groups, I am going to discard the remaining groups as I do not need them in my next calculations. The data are not guaranteed to be well separated, but always there will be a set of data that are closer to each other than other set of data.

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by