What kind of contours can you currently extract (and can you place
such an example online)? If you can at least get the broken contours,
using a kd-tree to search for neighbors and connecting them should be
quick.
Stefan, here is example by the book: http://i.imgur.com/tgphMUK.png