# Distinguish between chains

8 views (last 30 days)
Stephen Morris on 18 Jul 2011
[EDIT: 20110718 16:11 - include images - WDR]
I need to be able to distinguish between to beaded chains that are lying next to each other. I can already find the location of each bead but I do not know how I can automatically determine which chain each bead belongs to. It is important that both chains are physically the same so I can't do to different colours.
Here are some sample images (raw b/w picture, filtered to show the beads, center of each bead marked): http://imageshack.us/g/405/testymh.jpg/
Any ideas?
Justin Bondy on 19 Jul 2011
The beads of the same chain can infact touch. The beads are hollow and the thread just goes into them. Sorry I did not make this clear.

Walter Roberson on 18 Jul 2011
Insufficient information about your premises. Do chains ever cross? Do they ever fork?
If they never cross and never fork, then in the simpler case, imdilate() to get a continuous line, threshold, bwboundary with no holes. That will get you the outer chain contour.
I indicate this as the "simpler case" in that this approach does not, without modification, consider the possibility of the chain ending. Having the chain end "in the middle of the picture" is something that is possibly tractable. If, though, a chain might end exactly where it touches another chain, then determining which chain is which might be difficult.
Can there ever be three chains in the image? Three chains that all happen to end at the same area? Is the threading definitely not captured in the images?
Sean de Wolski on 19 Jul 2011
@Walter: Your using the boundaries idea is good but the concave part where the outer boundary is the inner chain at the bottom-right hand corner would fail it.
@Justin: How much control do you have over the image acquisition system? I would recommend trying to get zoomed in on the chains. Even if they're close and touching; I think it would be much easier if we could see the linkage and have it actually distinguishable.

Justin Bondy on 19 Jul 2011
Sorry about the lack of info. The chains should never cross and (for now) they will not fork (though eventually I intend to use looped chains).
They are not magnetic chains, but the threading does not easily show up in the images. I am working to try and get them to show up more. You can see a picture where they show up here http://img219.imageshack.us/img219/8585/test2oi.jpg
I will play around with imdilate() and see if it helps.
Thanks
Justin Bondy on 19 Jul 2011
@Walter I don't think I understand what you mean by parity counting. Do you mean create a grid on the image and have each line return how many objects (beads) it encountered?