segregate various elements of a matrix into separate groups based on their close proximity
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Image Analyst
2018-2-9
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
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!