I am working on image processing, and right know I have the next problem. From the original image I have got an array of 1's and 0's (by the way, in part thanks to the help of this list). Lets say I have something like this
Well, here we have have what I call two islands of 1's in a sea of 0's. Now, the question is, how to delimitate the extrem values of the islands? i.e., how to get the indexes of the 1's which are more to the left, right, up and down in each island?
I have thought about this: I search for a 1, and when I find it, I search for its neighbors (two 1's are neigbors if you can go from one to the other by passing only across 1's), and as I find its neighbors I stores the extrem values of the indexes. Well, I guess this can be a way. But actually I don't know how to define a function that tells me either two 1's are neighbors or not. Any idea about how to do it?
Thanks in advance