segregate various elements of a matrix into separate groups based on their close proximity
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hossam Selim
le 9 Fév 2018
Commenté : Hossam Selim
le 9 Fév 2018
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.
0 commentaires
Réponse acceptée
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
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!