I have gotten the space between adjacent blobs in the "space_vector" as well as the "median" distance. What I want to do is to group blobs that are separated by the distance "median" in each line and assign a number such that the first group would be "1", second group "2".....and so on. I can't figure out how to do it . Please can anyone help? Thanks in advance.